# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
517318 | perseverance201 | Job Scheduling (CEOI12_jobs) | Cpython 3 | 1065 ms | 65540 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
from pprint import pprint
n, d, m = list(map(int, input().strip().split()))
requests = list(map(int, input().strip().split()))
request_count = {}
for idx, request in enumerate(requests):
if request in request_count:
request_count[request].append(idx+1)
else:
request_count[request] = [idx+1]
def min_machine(x):
pending_job = 0
for day in range(1, n-d+1):
pending_job += len(request_count.get(day, []))
pending_job -= min(x, pending_job)
if pending_job > 0:
return False
else:
return True
def bin_search(low, high, f):
while low < high:
mid = low + (high-low)//2
if f(mid):
high = mid
else:
low = mid + 1
return low
ans = bin_search(1, int(1e6), min_machine)
print(ans)
pending_job = []
ptr = 0
for day in range(1, n+1):
pending_job += request_count.get(day, [])
if ptr < len(pending_job):
for i in range(ans):
print(pending_job[ptr], end=' ')
ptr += 1
print(0)
else:
print(0)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |