Skip to content

Instantly share code, notes, and snippets.

@inspirit941
Last active February 8, 2020 09:43
Show Gist options
  • Save inspirit941/00071e67adeec9dbe3890459c5d262ec to your computer and use it in GitHub Desktop.
Save inspirit941/00071e67adeec9dbe3890459c5d262ec to your computer and use it in GitHub Desktop.
def solution(n, times):
## 최악의 경우: 가장 비효율적인 심사관에게 다 받는 경우의 시간.
left, right = 1, max(times) * n
answer = 0
while left <= right:
# 한 심사관에게 주어진 시간
mid = (left + right) // 2
people = 0
for i in times:
# 각 심사관마다, 주어진 시간 동안 몇 명의 사람을 심사할 수 있는지
people += mid // i
# 모든 사람을 심사할 수 있으면 시간을 줄여본다
if people >= n:
answer = mid
right = mid - 1
break
# 모든 사람을 심사할 수 없는 경우
# 한 심사관에게 주어진 시간을 늘려본다.
if people < n :
left = mid + 1
return answer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment