답안 #446926

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
446926 2021-07-23T22:30:19 Z ntarsis Job Scheduling (CEOI12_jobs) PyPy 3
0 / 100
1000 ms 65540 KB
n,d,m = map(int,input().split())
nums = [int(x) for x in input().split()]
for i in range(m):
    nums[i]=[nums[i],i+1]
nums.sort()
def check(x):
    time = [0]*x
    c = 0
    ans = 0
    for i in range(m):
        if c == x:
            c = 0
        if time[c] >= nums[i][0]:
            time[c]+=1
            ans = max(ans,time[c]-nums[i][0])
        else:
            time[c]=nums[i][0]
        c+=1
    return ans <= d
lo = 1
hi = m
while lo < hi:
    mid = (lo+hi)//2
    if check(mid):
        hi = mid
    else:
        lo = mid+1
print(lo)
final = [[] for i in range(10001)]
last = [0]*lo
c = 0
for i in range(m):
    if c == lo:
        c = 0
    last[c] = max(last[c]+1,nums[i][0])
    final[last[c]].append(nums[i][1])
    c+=1
for i in range(1,n+1):
    print(*(final[i]+[0]))



# 결과 실행 시간 메모리 Grader output
1 Runtime error 264 ms 42424 KB Memory limit exceeded
2 Runtime error 254 ms 42184 KB Memory limit exceeded
3 Runtime error 276 ms 42248 KB Memory limit exceeded
4 Runtime error 267 ms 42664 KB Memory limit exceeded
5 Runtime error 308 ms 42556 KB Memory limit exceeded
6 Runtime error 253 ms 42572 KB Memory limit exceeded
7 Runtime error 252 ms 42592 KB Memory limit exceeded
8 Runtime error 252 ms 42612 KB Memory limit exceeded
9 Runtime error 562 ms 39808 KB Execution failed because the return code was nonzero
10 Runtime error 639 ms 39100 KB Execution failed because the return code was nonzero
11 Runtime error 700 ms 38176 KB Memory limit exceeded
12 Execution timed out 1083 ms 44584 KB Time limit exceeded
13 Execution timed out 1099 ms 52184 KB Time limit exceeded
14 Execution timed out 1095 ms 65400 KB Time limit exceeded
15 Runtime error 250 ms 65536 KB Execution killed with signal 9
16 Runtime error 298 ms 65540 KB Execution killed with signal 9
17 Runtime error 148 ms 65536 KB Execution killed with signal 9
18 Runtime error 145 ms 65536 KB Execution killed with signal 9
19 Runtime error 150 ms 65536 KB Execution killed with signal 9
20 Runtime error 148 ms 65536 KB Execution killed with signal 9