Baekjoon #1477

Baekjoon #1477

1개의 풀이 · Python

문제 원문 보기 ↗

SOLUTION INFO

Python · main.py

main.py
import sys

def input():
    return sys.stdin.readline().rstrip()

n, m, l = map(int, input().split())
rests = sorted([0] + list(map(int, input().split())) + [l])

low = 1
high = l
answer = high
while low <= high:
    mid = (low + high) // 2
    
    cnt = 0
    for i in range(n+1):
        cnt += (rests[i+1] - rests[i] - 1) // mid 
        
    if cnt<=m:
        answer = mid
        high = mid - 1
    else:
        low = mid + 1
        
print(answer)

SOLUTION DESCRIPTION

풀이 설명

등록된 풀이 설명이 없습니다.