CSES - Aalto Competitive Programming 2024 - wk1 - Wed - Results
Submission details
Task:LumberUolevi
Sender:aalto2024a_004
Submission time:2024-09-04 16:56:16 +0300
Language:Python3 (CPython3)
Status:READY
Result:
Test results
testverdicttime
#1ACCEPTED0.02 sdetails
#2ACCEPTED0.02 sdetails
#3ACCEPTED0.02 sdetails
#40.02 sdetails
#5ACCEPTED0.02 sdetails
#6ACCEPTED0.02 sdetails
#7ACCEPTED0.02 sdetails
#8ACCEPTED0.02 sdetails
#9ACCEPTED0.02 sdetails
#10ACCEPTED0.02 sdetails
#110.02 sdetails
#12ACCEPTED0.02 sdetails
#13ACCEPTED0.02 sdetails
#140.02 sdetails
#15ACCEPTED0.02 sdetails
#16ACCEPTED0.02 sdetails
#170.02 sdetails
#18ACCEPTED0.02 sdetails
#19ACCEPTED0.02 sdetails
#20ACCEPTED0.02 sdetails
#21ACCEPTED0.02 sdetails
#22ACCEPTED0.02 sdetails
#230.02 sdetails
#24ACCEPTED0.02 sdetails
#25ACCEPTED0.02 sdetails
#26ACCEPTED0.02 sdetails
#27ACCEPTED0.02 sdetails
#280.02 sdetails
#290.02 sdetails
#30ACCEPTED0.02 sdetails
#310.02 sdetails
#320.02 sdetails
#330.02 sdetails
#340.02 sdetails
#350.02 sdetails
#360.02 sdetails
#370.02 sdetails
#380.02 sdetails
#39ACCEPTED0.02 sdetails
#40ACCEPTED0.02 sdetails
#41ACCEPTED0.03 sdetails
#420.06 sdetails
#430.13 sdetails
#44ACCEPTED0.07 sdetails
#45ACCEPTED0.04 sdetails
#460.16 sdetails
#47ACCEPTED0.54 sdetails
#48ACCEPTED0.04 sdetails
#49ACCEPTED0.72 sdetails
#500.04 sdetails
#51--details
#52--details
#53--details
#54--details
#55--details
#56--details
#57--details
#58--details
#59--details
#60--details
#61--details
#62--details
#63--details

Code

def get_largest_number_fitting(tree_list, max_space):
    return next(x for x in reversed(tree_list) if x <= max_space)


n, k = [int(x) for x in input().split()]

trees = [x for x in range(1, n + 1)]

result = []
number_selected = 0
current_truck_space = n
while number_selected < k and trees:
    tree = get_largest_number_fitting(trees, current_truck_space)
    current_truck_space = current_truck_space - tree
    if current_truck_space == 0:
        current_truck_space = n
    result.append(tree)
    trees.remove(tree)
    number_selected += 1

for t in result:
    print(t, sep=" ")

Test details

Test 1

Verdict: ACCEPTED

input
1 1

correct output

user output
1

Test 2

Verdict: ACCEPTED

input
2 1

correct output

user output
2

Test 3

Verdict: ACCEPTED

input
2 1

correct output

user output
2

Test 4

Verdict:

input
3 2

correct output
1 2 

user output
3
2

Test 5

Verdict: ACCEPTED

input
3 3

correct output
1 2 3 

user output
3
2
1

Test 6

Verdict: ACCEPTED

input
4 1

correct output

user output
4

Test 7

Verdict: ACCEPTED

input
4 4

correct output
1 2 3 4 

user output
4
3
1
2

Test 8

Verdict: ACCEPTED

input
5 1

correct output

user output
5

Test 9

Verdict: ACCEPTED

input
5 5

correct output
1 2 3 4 5 

user output
5
4
1
3
2

Test 10

Verdict: ACCEPTED

input
6 1

correct output

user output
6

Test 11

Verdict:

input
10 6

correct output
1 2 3 5 9 10 

user output
10
9
1
8
2
...

Test 12

Verdict: ACCEPTED

input
10 5

correct output
1 2 3 4 10 

user output
10
9
1
8
2

Test 13

Verdict: ACCEPTED

input
10 5

correct output
1 2 3 4 10 

user output
10
9
1
8
2

Test 14

Verdict:

input
10 6

correct output
1 2 3 5 9 10 

user output
10
9
1
8
2
...

Test 15

Verdict: ACCEPTED

input
10 10

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

user output
10
9
1
8
2
...

Test 16

Verdict: ACCEPTED

input
11 3

correct output
1 2 8 

user output
11
10
1

Test 17

Verdict:

input
11 10

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

user output
11
10
1
9
2
...

Test 18

Verdict: ACCEPTED

input
11 1

correct output
11 

user output
11

Test 19

Verdict: ACCEPTED

input
12 11

correct output
1 2 3 4 5 7 8 9 10 11 12 

user output
12
11
1
10
2
...

Test 20

Verdict: ACCEPTED

input
12 1

correct output
12 

user output
12

Test 21

Verdict: ACCEPTED

input
20 11

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

user output
20
19
1
18
2
...

Test 22

Verdict: ACCEPTED

input
20 9

correct output
1 2 3 4 5 6 7 12 20 

user output
20
19
1
18
2
...

Test 23

Verdict:

input
21 10

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

user output
21
20
1
19
2
...

Test 24

Verdict: ACCEPTED

input
22 13

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

user output
22
21
1
20
2
...

Test 25

Verdict: ACCEPTED

input
20 20

correct output
1 2 3 4 5 6 7 8 9 10 11 12 13 ...

user output
20
19
1
18
2
...

Test 26

Verdict: ACCEPTED

input
20 5

correct output
1 2 3 4 10 

user output
20
19
1
18
2

Test 27

Verdict: ACCEPTED

input
23 21

correct output
1 2 3 4 5 6 7 8 9 10 13 14 15 ...

user output
23
22
1
21
2
...

Test 28

Verdict:

input
24 2

correct output
1 23 

user output
24
23

Test 29

Verdict:

input
20 18

correct output
1 2 3 4 5 6 7 8 9 10 11 12 13 ...

user output
20
19
1
18
2
...

Test 30

Verdict: ACCEPTED

input
25 1

correct output
25 

user output
25

Test 31

Verdict:

input
123 68

correct output
1 2 3 4 5 6 7 8 9 10 11 12 13 ...

user output
123
122
1
121
2
...
Truncated

Test 32

Verdict:

input
201 84

correct output
1 2 3 4 5 6 7 8 9 10 11 12 13 ...

user output
201
200
1
199
2
...
Truncated

Test 33

Verdict:

input
200 88

correct output
1 2 3 4 5 6 7 8 9 10 11 12 13 ...

user output
200
199
1
198
2
...
Truncated

Test 34

Verdict:

input
202 112

correct output
1 2 3 4 5 6 7 8 9 10 11 12 13 ...

user output
202
201
1
200
2
...
Truncated

Test 35

Verdict:

input
200 194

correct output
1 2 3 4 5 6 7 8 9 10 11 12 13 ...

user output
200
199
1
198
2
...
Truncated

Test 36

Verdict:

input
204 46

correct output
1 2 3 4 5 6 7 8 9 10 11 12 13 ...

user output
204
203
1
202
2
...
Truncated

Test 37

Verdict:

input
205 184

correct output
1 2 3 4 5 6 7 8 9 10 11 12 13 ...

user output
205
204
1
203
2
...
Truncated

Test 38

Verdict:

input
200 16

correct output
1 2 3 4 5 6 7 8 9 10 11 12 13 ...

user output
200
199
1
198
2
...

Test 39

Verdict: ACCEPTED

input
207 181

correct output
1 2 3 4 5 6 7 8 9 10 11 12 13 ...

user output
207
206
1
205
2
...
Truncated

Test 40

Verdict: ACCEPTED

input
201 3

correct output
1 2 198 

user output
201
200
1

Test 41

Verdict: ACCEPTED

input
1123 617

correct output
1 2 3 4 5 6 7 8 9 10 11 12 13 ...

user output
1123
1122
1
1121
2
...
Truncated

Test 42

Verdict:

input
2201 918

correct output
1 2 3 4 5 6 7 8 9 10 11 12 13 ...

user output
2201
2200
1
2199
2
...
Truncated

Test 43

Verdict:

input
3200 1396

correct output
1 2 3 4 5 6 7 8 9 10 11 12 13 ...

user output
3200
3199
1
3198
2
...
Truncated

Test 44

Verdict: ACCEPTED

input
2202 1213

correct output
1 2 3 4 5 6 7 8 9 10 11 12 13 ...

user output
2202
2201
1
2200
2
...
Truncated

Test 45

Verdict: ACCEPTED

input
1200 1161

correct output
1 2 3 4 5 6 7 8 9 10 11 12 13 ...

user output
1200
1199
1
1198
2
...
Truncated

Test 46

Verdict:

input
5204 1156

correct output
1 2 3 4 5 6 7 8 9 10 11 12 13 ...

user output
5204
5203
1
5202
2
...
Truncated

Test 47

Verdict: ACCEPTED

input
6205 5541

correct output
1 2 3 4 5 6 7 8 9 10 11 12 13 ...

user output
6205
6204
1
6203
2
...
Truncated

Test 48

Verdict: ACCEPTED

input
3200 245

correct output
1 2 3 4 5 6 7 8 9 10 11 12 13 ...

user output
3200
3199
1
3198
2
...
Truncated

Test 49

Verdict: ACCEPTED

input
7207 6295

correct output
1 2 3 4 5 6 7 8 9 10 11 12 13 ...

user output
7207
7206
1
7205
2
...
Truncated

Test 50

Verdict:

input
9201 96

correct output
1 2 3 4 5 6 7 8 9 10 11 12 13 ...

user output
9201
9200
1
9199
2
...
Truncated

Test 51

Verdict:

input
51123 28058

correct output
1 2 3 4 5 6 7 8 9 10 11 12 13 ...

user output
(empty)

Test 52

Verdict:

input
32201 13429

correct output
1 2 3 4 5 6 7 8 9 10 11 12 13 ...

user output
(empty)

Test 53

Verdict:

input
23200 10116

correct output
1 2 3 4 5 6 7 8 9 10 11 12 13 ...

user output
(empty)

Test 54

Verdict:

input
12202 6721

correct output
1 2 3 4 5 6 7 8 9 10 11 12 13 ...

user output
(empty)

Test 55

Verdict:

input
21200 20502

correct output
1 2 3 4 5 6 7 8 9 10 11 12 13 ...

user output
(empty)

Test 56

Verdict:

input
35204 7816

correct output
1 2 3 4 5 6 7 8 9 10 11 12 13 ...

user output
(empty)

Test 57

Verdict:

input
46205 41255

correct output
1 2 3 4 5 6 7 8 9 10 11 12 13 ...

user output
(empty)

Test 58

Verdict:

input
63200 4823

correct output
1 2 3 4 5 6 7 8 9 10 11 12 13 ...

user output
(empty)

Test 59

Verdict:

input
87207 76170

correct output
1 2 3 4 5 6 7 8 9 10 11 12 13 ...

user output
(empty)

Test 60

Verdict:

input
99201 1030

correct output
1 2 3 4 5 6 7 8 9 10 11 12 13 ...

user output
(empty)

Test 61

Verdict:

input
100000 54883

correct output
1 2 3 4 5 6 7 8 9 10 11 12 13 ...

user output
(empty)

Test 62

Verdict:

input
100000 41703

correct output
1 2 3 4 5 6 7 8 9 10 11 12 13 ...

user output
(empty)

Test 63

Verdict:

input
100000 43601

correct output
1 2 3 4 5 6 7 8 9 10 11 12 13 ...

user output
(empty)