-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[이지민] - 주차장, 순위, 백도어 #193
[이지민] - 주차장, 순위, 백도어 #193
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
고생하셨습니다!
@@ -0,0 +1,45 @@ | |||
''' | |||
roads를 처음에 n*n 행렬로 했더니 메모리 초과가 났다. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
저도요 ㅋㅋㅋㅋㅋ
import sys | ||
import heapq | ||
|
||
INF = sys.maxsize |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
옹... 이럼 얼마가 담기나요 파이썬은?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
9223372036854775807
이 만큼 찍히네요 ㅋㅋ
for k in range(1, n + 1): | ||
for i in range(1, n + 1): | ||
for j in range(1, n + 1): | ||
if i != j and players[i][j] == 0: | ||
if players[i][k] * players[k][j] > 0: | ||
players[i][j] = players[i][k] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
지민님, 병희님 덕분에 저도 궁금증을 해결하구 갑니다..
그리고 *을 때 양수로 판정하는 부분 짱인 것 같아요
for i in range(2 * m): | ||
car = int(sys.stdin.readline()) | ||
if car > 0: | ||
if not all(visited): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all이 있군요 파이썬도
for k in range(1, n + 1): | ||
for i in range(1, n + 1): | ||
for j in range(1, n + 1): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
플로이드 워셜로 손쉽게 풀 수 있었군요!!
distance[start] = 0 | ||
|
||
pq = [] | ||
heapq.heappush(pq, [0, start]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
저도 pq 로 다시 풀어봐야겠네요!
|
||
if visited[start]: | ||
continue | ||
visited[start] = 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
그냥 0 또는 1로만 처리해줘도 되는군요~~~~
for i in range(1, n + 1): | ||
for j in range(1, n + 1): | ||
if i != j and players[i][j] == 0: | ||
if players[i][k] * players[k][j] > 0: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
와 곱한 거 좋네요...
📌 from issue #190 📌
📋문제 목록📋