Submission #498187

# Submission time Handle Problem Language Result Execution time Memory
498187 2021-12-24T14:41:27 Z arisja Job Scheduling (CEOI12_jobs) Python 3
0 / 100
1000 ms 65540 KB
def f(ar, x, n, d, m):
    st = []
    new_req = 0
    for i in range(1, n + 1):
        st.append([])
        for j in range(x):
            if ar[new_req][0] > i:
                break
            if new_req + d >= i:
                #st += str(ar[new_req][1]) + ' '
                st[i-1].append(ar[new_req][1])
                new_req += 1
            else:
                return False, st
            if new_req == m:
                return True, st
    return False, st
            


def lower_bound(ar):
    global stor1
    l = 0
    r = len(ar)
    while r - l != 1:
        mid = (r + l) // 2
        stor = f(ar, mid, n, d, m)
        if stor[0]:
            r = mid
            stor1 = stor
        else:
            l = mid
    return r

stor1 =''
n, d, m = map(int, input().split())
ar = list(map(int, input().split()))
for i in range(m):
    ar[i] = [ar[i], i + 1]
ar.sort()
print(lower_bound(ar))
#print(stor1[1])
for i in range(n):
    if i >= len(stor1[1]):
        print('0')
    elif stor1[1][i] == []:
        print('0')
    else:
        print(" ".join(map(str, stor1[1][i])) + ' 0')
# Verdict Execution time Memory Grader output
1 Runtime error 111 ms 15276 KB Execution failed because the return code was nonzero
2 Runtime error 95 ms 15140 KB Execution failed because the return code was nonzero
3 Runtime error 103 ms 15136 KB Execution failed because the return code was nonzero
4 Runtime error 114 ms 15168 KB Execution failed because the return code was nonzero
5 Runtime error 123 ms 15148 KB Execution failed because the return code was nonzero
6 Runtime error 112 ms 15200 KB Execution failed because the return code was nonzero
7 Runtime error 106 ms 15084 KB Execution failed because the return code was nonzero
8 Runtime error 105 ms 15128 KB Execution failed because the return code was nonzero
9 Execution timed out 1095 ms 29008 KB Time limit exceeded
10 Execution timed out 1089 ms 29036 KB Time limit exceeded
11 Execution timed out 1055 ms 20056 KB Time limit exceeded
12 Execution timed out 1086 ms 34784 KB Time limit exceeded
13 Execution timed out 1085 ms 50888 KB Time limit exceeded
14 Runtime error 345 ms 65540 KB Execution killed with signal 9
15 Runtime error 359 ms 65540 KB Execution killed with signal 9
16 Runtime error 128 ms 65540 KB Execution killed with signal 9
17 Runtime error 118 ms 65540 KB Execution killed with signal 9
18 Runtime error 74 ms 65540 KB Execution killed with signal 9
19 Runtime error 82 ms 65536 KB Execution killed with signal 9
20 Runtime error 138 ms 65540 KB Execution killed with signal 9