-
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
[이지민] - A와 B 2, 알고스팟, 회장뽑기, 입국심사 #189
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.
고생하셨어요!!
answer = sys.maxsize | ||
|
||
front = 1 | ||
last = 1_000_000_000 * 1_000_000_000 |
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.
파이썬은 이런게 부럽네요...
def bfs(target): | ||
global n, info | ||
queue = deque([[target, 0]]) | ||
visited = [0 for _ in range(n + 1)] | ||
|
||
while queue: | ||
now, num = queue.popleft() | ||
for i in friends[now]: | ||
if i != target and not visited[i]: | ||
queue.append([i, num + 1]) | ||
visited[i] = num + 1 | ||
|
||
return num |
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.
엄청 깔끔하게 로직 잘 짜신 것 같아요..!!
front = mid + 1 | ||
else: | ||
last = mid - 1 | ||
answer = mid |
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.
answer 를 여기서 최신화 시켜서 리턴 시키는 게 더 잘 읽히네요!
queue.append([i, num + 1]) | ||
visited[i] = num + 1 | ||
|
||
return num |
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.
오 점수를 이렇게 한 번에 구하신 게 좋네요!
set_recursion(b[:-1]) | ||
|
||
if b[0] == 'B': | ||
set_recursion(b[:0:-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.
와 부럽다 파이썬...
queue.append([i, num + 1]) | ||
visited[i] = num + 1 | ||
|
||
return num |
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.
num이 리턴되니 로직이 훨씬 깔끔한 것 같아요 멋집니당
📌 from issue #185 📌
📋문제 목록📋
📍추가로 해결한 문제📍