238242026-01-30 14:59:11vyrallMegrendelésekpython3Wrong answer 0/50699ms29584 KiB
from operator import itemgetter

n, m ,k = map(int, input().split())
orders = list(map(int, input().split()))
indexes = list(range(1, m+1))
indexes, orders = zip(*sorted(zip(indexes, orders), key=itemgetter(1)))
indexes, orders = list(indexes), list(orders)
chosen = []


for i in range(1, n+1):
    available = [j for j in orders if j >= i]
    aval_inds = indexes[:len(available)]
    print(available, aval_inds)
    for _ in range(k):
        if available:
            pick_idx = aval_inds[0]
            chosen.append((pick_idx, i))
            available = available[1:]
            orders = orders[1:]
            aval_inds = aval_inds[1:]
            indexes = indexes[1:]
    if orders:
        while orders[0] <= i:
            orders = orders[1:]
            indexes = indexes[1:]

print(len(chosen))
for i in chosen:
    print(i[0], i[1])
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Wrong answer17ms3312 KiB
2Time limit exceeded677ms29584 KiB
subtask20/5
3Wrong answer17ms3312 KiB
4Wrong answer17ms3228 KiB
5Wrong answer17ms3124 KiB
6Wrong answer17ms3172 KiB
7Wrong answer17ms3144 KiB
subtask30/5
8Wrong answer17ms3124 KiB
9Wrong answer19ms3376 KiB
10Wrong answer20ms3396 KiB
11Wrong answer24ms3640 KiB
12Wrong answer30ms3832 KiB
subtask40/5
13Runtime error20ms3576 KiB
14Time limit exceeded601ms22700 KiB
15Runtime error219ms9776 KiB
16Runtime error377ms10748 KiB
17Wrong answer97ms5940 KiB
subtask50/10
18Wrong answer17ms3124 KiB
19Wrong answer19ms3372 KiB
20Wrong answer152ms8752 KiB
21Wrong answer172ms9432 KiB
22Wrong answer68ms4968 KiB
23Runtime error26ms3688 KiB
24Wrong answer173ms9524 KiB
25Time limit exceeded605ms24632 KiB
26Time limit exceeded605ms24428 KiB
27Time limit exceeded675ms26396 KiB
subtask60/25
28Runtime error27ms3632 KiB
29Wrong answer17ms3108 KiB
30Wrong answer43ms4424 KiB
31Time limit exceeded603ms18020 KiB
32Time limit exceeded699ms16028 KiB
33Wrong answer546ms19476 KiB
34Time limit exceeded685ms16492 KiB
35Time limit exceeded685ms9588 KiB
36Time limit exceeded699ms19768 KiB
37Time limit exceeded688ms12004 KiB
38Wrong answer532ms19480 KiB
39Wrong answer64ms4916 KiB
40Wrong answer150ms7900 KiB
41Time limit exceeded699ms27776 KiB
42Wrong answer116ms3636 KiB
43Wrong answer540ms19476 KiB
44Time limit exceeded685ms24976 KiB
45Wrong answer101ms4916 KiB
46Wrong answer158ms5684 KiB
47Time limit exceeded689ms28924 KiB
48Time limit exceeded681ms24576 KiB
49Time limit exceeded699ms19856 KiB
50Time limit exceeded676ms16240 KiB
51Time limit exceeded684ms14316 KiB
52Time limit exceeded686ms12956 KiB