Submission details
Task:Good grades
Sender:aalto26iw_002
Submission time:2026-11-04 17:09:11 +0200
Language:Python3 (PyPy3)
Status:READY
Result:
Test results
testverdicttime
#10.06 sdetails
#20.06 sdetails
#30.04 sdetails
#40.06 sdetails
#50.04 sdetails
#60.04 sdetails
#70.04 sdetails
#80.06 sdetails
#90.04 sdetails
#100.04 sdetails
#110.04 sdetails
#120.04 sdetails
#130.04 sdetails
#140.06 sdetails
#150.04 sdetails
#160.06 sdetails
#170.04 sdetails
#180.06 sdetails
#190.04 sdetails
#200.04 sdetails
#210.04 sdetails
#220.04 sdetails
#230.04 sdetails
#240.06 sdetails
#250.04 sdetails
#260.04 sdetails
#270.04 sdetails
#280.04 sdetails
#290.04 sdetails
#300.04 sdetails
#310.04 sdetails
#320.04 sdetails
#330.04 sdetails
#340.04 sdetails
#350.04 sdetails
#360.04 sdetails
#370.04 sdetails
#380.04 sdetails
#390.04 sdetails
#400.04 sdetails
#410.04 sdetails
#420.04 sdetails
#430.04 sdetails
#440.04 sdetails
#450.04 sdetails
#460.04 sdetails
#470.04 sdetails
#480.04 sdetails
#490.04 sdetails
#500.04 sdetails
#510.04 sdetails
#520.04 sdetails
#530.04 sdetails
#540.04 sdetails
#550.04 sdetails
#560.04 sdetails
#570.04 sdetails
#580.04 sdetails
#590.04 sdetails

Code

def main():

    n, k = map(int, input().split())
    smarts = list(map(int, input().split()))

    order = sorted(range(n), key=lambda i: smarts[i], reverse=True)


    #print(order)

    array = [0] * n

    for i in range(1, k+1):
        array[order[i]] = i

    #print(array[:k])
    #print(array[k:n])

    for i in range(k, n):
        array[order[i]] = k

    print(*array)


main()


Test details

Test 1

Verdict:

input
1 1
8 

correct output
1 

user output
(empty)

Error:
Traceback (most recent call last):
  File "/box/input/code.py", line 25, in <module>
    main()
  File "/box/input/code.py", line 14, in main
    array[order[i]] = i
IndexError: list index out of range

Test 2

Verdict:

input
2 2
7 6 

correct output
2 1 

user output
(empty)

Error:
Traceback (most recent call last):
  File "/box/input/code.py", line 25, in <module>
    main()
  File "/box/input/code.py", line 14, in main
    array[order[i]] = i
IndexError: list index out of range

Test 3

Verdict:

input
2 1
7 7 

correct output
1 1 

user output
0 1

Test 4

Verdict:

input
2 2
7 1 

correct output
2 1 

user output
(empty)

Error:
Traceback (most recent call last):
  File "/box/input/code.py", line 25, in <module>
    main()
  File "/box/input/code.py", line 14, in main
    array[order[i]] = i
IndexError: list index out of range

Test 5

Verdict:

input
3 1
5 10 8 

correct output
1 1 1 

user output
1 0 1

Test 6

Verdict:

input
3 1
6 10 2 

correct output
1 1 1 

user output
1 0 1

Test 7

Verdict:

input
4 1
10 10 4 2 

correct output
1 1 1 1 

user output
0 1 1 1

Test 8

Verdict:

input
4 4
5 1 5 4 

correct output
3 1 4 2 

user output
(empty)

Error:
Traceback (most recent call last):
  File "/box/input/code.py", line 25, in <module>
    main()
  File "/box/input/code.py", line 14, in main
    array[order[i]] = i
IndexError: list index out of range

Test 9

Verdict:

input
4 2
1 6 7 1 

correct output
1 2 2 1 

user output
2 1 0 2

Test 10

Verdict:

input
5 3
6 8 9 7 9 

correct output
1 2 3 1 3 

user output
3 2 0 3 1

Test 11

Verdict:

input
5 3
10 8 10 1 2 

correct output
3 2 3 1 1 

user output
0 2 1 3 3

Test 12

Verdict:

input
5 3
2 1 10 6 10 

correct output
1 1 3 2 3 

user output
3 3 0 2 1

Test 13

Verdict:

input
5 3
1 8 9 3 2 

correct output
1 3 3 2 1 

user output
3 1 0 2 3

Test 14

Verdict:

input
5 5
10 6 2 10 9 

correct output
4 2 1 5 3 

user output
(empty)

Error:
Traceback (most recent call last):
  File "/box/input/code.py", line 25, in <module>
    main()
  File "/box/input/code.py", line 14, in main
    array[order[i]] = i
IndexError: list index out of range

Test 15

Verdict:

input
5 2
1 9 9 3 4 

correct output
1 2 2 1 1 

user output
2 0 1 2 2

Test 16

Verdict:

input
5 5
10 4 3 9 1 

correct output
5 3 2 4 1 

user output
(empty)

Error:
Traceback (most recent call last):
  File "/box/input/code.py", line 25, in <module>
    main()
  File "/box/input/code.py", line 14, in main
    array[order[i]] = i
IndexError: list index out of range

Test 17

Verdict:

input
5 1
3 8 4 5 10 

correct output
1 1 1 1 1 

user output
1 1 1 1 0

Test 18

Verdict:

input
5 5
1 10 3 9 4 

correct output
1 5 2 4 3 

user output
(empty)

Error:
Traceback (most recent call last):
  File "/box/input/code.py", line 25, in <module>
    main()
  File "/box/input/code.py", line 14, in main
    array[order[i]] = i
IndexError: list index out of range

Test 19

Verdict:

input
5 1
4 6 5 5 1 

correct output
1 1 1 1 1 

user output
1 0 1 1 1

Test 20

Verdict:

input
10 6
6 8 9 7 9 6 9 5 7 7 

correct output
2 4 5 3 5 2 6 1 3 3 

user output
6 3 0 4 1 6 2 6 5 6

Test 21

Verdict:

input
10 5
10 8 10 1 2 4 10 2 3 1 

correct output
5 4 5 1 2 3 5 2 2 1 

user output
0 3 1 5 5 4 2 5 5 5

Test 22

Verdict:

input
10 5
2 1 10 6 10 5 5 5 4 4 

correct output
1 1 5 4 5 3 3 3 2 2 

user output
5 5 0 2 1 3 4 5 5 5

Test 23

Verdict:

input
10 6
1 8 9 3 2 6 6 9 5 9 

correct output
1 5 6 2 1 4 4 6 3 6 

user output
6 3 0 6 6 4 5 1 6 2

Test 24

Verdict:

input
10 10
10 6 2 10 9 8 7 7 6 3 

correct output
9 3 1 10 8 7 5 6 4 2 

user output
(empty)

Error:
Traceback (most recent call last):
  File "/box/input/code.py", line 25, in <module>
    main()
  File "/box/input/code.py", line 14, in main
    array[order[i]] = i
IndexError: list index out of range

Test 25

Verdict:

input
10 3
1 9 9 3 4 10 10 5 1 7 

correct output
1 3 3 1 2 3 3 2 1 2 

user output
3 2 3 3 3 0 1 3 3 3

Test 26

Verdict:

input
10 9
10 4 3 9 1 1 4 2 10 6 

correct output
8 4 3 7 1 1 5 2 9 6 

user output
0 4 6 2 8 9 5 7 1 3

Test 27

Verdict:

input
10 1
3 8 4 5 10 8 5 10 4 6 

correct output
1 1 1 1 1 1 1 1 1 1 

user output
1 1 1 1 0 1 1 1 1 1

Test 28

Verdict:

input
10 9
1 10 3 9 4 6 9 3 5 1 

correct output
1 9 2 7 4 6 8 3 5 1 

user output
8 0 6 1 5 3 2 7 4 9

Test 29

Verdict:

input
10 1
4 6 5 5 1 2 4 2 1 3 

correct output
1 1 1 1 1 1 1 1 1 1 

user output
1 0 1 1 1 1 1 1 1 1

Test 30

Verdict:

input
100 55
636562060 767928734 906523441 ...

correct output
32 42 50 33 51 29 50 23 35 37 ...

user output
41 22 8 40 6 46 7 55 34 31 55 ...

Test 31

Verdict:

input
100 42
773442532 122816 137572579 324...

correct output
34 1 8 16 9 13 6 20 10 19 18 3...

user output
21 42 42 42 42 42 42 42 42 42 ...

Test 32

Verdict:

input
100 44
198730372 27838076 590195590 4...

correct output
9 1 28 21 23 20 15 16 7 10 36 ...

user output
44 44 32 44 44 44 44 44 44 44 ...

Test 33

Verdict:

input
100 56
75940263 760367935 901888417 3...

correct output
6 44 51 19 8 33 36 54 29 54 1 ...

user output
56 20 8 56 56 39 33 4 49 2 56 ...

Test 34

Verdict:

input
100 97
967034924 587586158 185430194 ...

correct output
94 59 19 88 79 67 77 64 27 15 ...

user output
3 40 81 9 19 32 21 35 73 85 71...

Test 35

Verdict:

input
100 23
59249204 934941692 892631472 2...

correct output
2 22 21 6 10 23 12 3 15 11 19 ...

user output
23 6 10 23 23 2 23 23 23 23 19...

Test 36

Verdict:

input
100 90
356460601 224848374 881788059 ...

correct output
23 14 83 4 1 28 8 54 7 48 56 3...

user output
76 86 9 90 90 71 90 43 90 50 4...

Test 37

Verdict:

input
100 8
244103474 837431431 342493822 ...

correct output
2 7 3 5 7 5 3 6 3 5 1 1 5 3 1 ...

user output
8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 ...

Test 38

Verdict:

input
100 88
11934038 257096283 933290530 4...

correct output
1 24 83 40 56 80 23 44 1 62 46...

user output
88 72 5 54 35 9 73 48 88 27 46...

Test 39

Verdict:

input
100 2
391337048 538883744 535937150 ...

correct output
1 2 2 2 1 1 1 1 1 1 2 1 1 1 1 ...

user output
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ...

Test 40

Verdict:

input
200 110
636562060 767928734 906523441 ...

correct output
69 86 99 70 101 61 100 47 74 7...

user output
75 40 16 74 14 90 15 110 65 60...

Test 41

Verdict:

input
200 84
773442532 122816 137572579 324...

correct output
66 1 14 28 16 23 11 36 18 35 3...

user output
45 84 84 84 84 84 84 84 84 84 ...

Test 42

Verdict:

input
200 88
198730372 27838076 590195590 4...

correct output
17 3 53 42 45 40 29 30 13 18 6...

user output
88 88 77 88 88 88 88 88 88 88 ...

Test 43

Verdict:

input
200 111
75940263 760367935 901888417 3...

correct output
8 85 100 35 14 62 71 106 51 10...

user output
111 48 19 111 111 92 77 9 111 ...

Test 44

Verdict:

input
200 194
967034924 587586158 185430194 ...

correct output
185 114 39 173 151 128 147 124...

user output
10 83 160 22 45 69 49 73 148 1...

Test 45

Verdict:

input
200 45
59249204 934941692 892631472 2...

correct output
3 43 41 11 19 45 25 5 30 21 37...

user output
45 11 20 45 45 5 45 45 45 45 4...

Test 46

Verdict:

input
200 179
356460601 224848374 881788059 ...

correct output
54 33 162 8 4 61 15 113 14 99 ...

user output
141 163 21 179 179 133 179 77 ...

Test 47

Verdict:

input
200 16
244103474 837431431 342493822 ...

correct output
4 14 6 8 13 9 6 10 5 10 2 2 8 ...

user output
16 16 16 16 16 16 16 16 16 16 ...

Test 48

Verdict:

input
200 175
11934038 257096283 933290530 4...

correct output
2 40 165 67 105 157 37 77 2 11...

user output
175 152 10 123 79 19 155 112 1...

Test 49

Verdict:

input
200 3
391337048 538883744 535937150 ...

correct output
2 2 2 2 1 1 1 1 1 1 3 2 1 1 1 ...

user output
3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 ...

Test 50

Verdict:

input
500 275
636562060 767928734 906523441 ...

correct output
176 215 251 178 254 161 252 12...

user output
183 106 45 181 39 217 43 275 1...

Test 51

Verdict:

input
500 209
773442532 122816 137572579 324...

correct output
163 1 31 72 37 57 23 89 45 87 ...

user output
112 209 209 209 209 209 209 20...

Test 52

Verdict:

input
500 218
198730372 27838076 590195590 4...

correct output
42 8 130 102 113 97 73 75 34 4...

user output
218 218 190 218 218 218 218 21...

Test 53

Verdict:

input
500 276
75940263 760367935 901888417 3...

correct output
20 205 249 85 32 149 165 267 1...

user output
276 120 45 276 276 219 191 15 ...

Test 54

Verdict:

input
500 484
967034924 587586158 185430194 ...

correct output
469 290 97 438 372 322 367 317...

user output
17 199 399 48 116 167 121 172 ...

Test 55

Verdict:

input
500 111
59249204 934941692 892631472 2...

correct output
5 104 100 24 42 109 55 9 70 46...

user output
111 31 53 111 111 9 111 111 11...

Test 56

Verdict:

input
500 447
356460601 224848374 881788059 ...

correct output
154 88 394 30 18 168 46 279 43...

user output
329 402 60 447 447 314 446 190...

Test 57

Verdict:

input
500 39
244103474 837431431 342493822 ...

correct output
9 33 13 18 31 19 13 23 11 21 3...

user output
39 39 39 39 39 39 39 39 39 39 ...

Test 58

Verdict:

input
500 437
11934038 257096283 933290530 4...

correct output
7 101 407 167 251 388 97 191 7...

user output
437 383 33 312 208 54 388 283 ...

Test 59

Verdict:

input
500 6
391337048 538883744 535937150 ...

correct output
3 4 4 4 1 2 3 2 1 2 6 3 2 2 2 ...

user output
6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 ...