Task: | Box Stack II |
Sender: | aalto2024d_002 |
Submission time: | 2024-09-25 17:04:02 +0300 |
Language: | Python3 (CPython3) |
Status: | READY |
Result: | TIME LIMIT EXCEEDED |
test | verdict | time | |
---|---|---|---|
#1 | ACCEPTED | 0.02 s | details |
#2 | ACCEPTED | 0.02 s | details |
#3 | ACCEPTED | 0.02 s | details |
#4 | ACCEPTED | 0.02 s | details |
#5 | ACCEPTED | 0.02 s | details |
#6 | ACCEPTED | 0.02 s | details |
#7 | ACCEPTED | 0.02 s | details |
#8 | ACCEPTED | 0.02 s | details |
#9 | ACCEPTED | 0.02 s | details |
#10 | ACCEPTED | 0.02 s | details |
#11 | ACCEPTED | 0.02 s | details |
#12 | ACCEPTED | 0.02 s | details |
#13 | ACCEPTED | 0.02 s | details |
#14 | ACCEPTED | 0.02 s | details |
#15 | ACCEPTED | 0.02 s | details |
#16 | ACCEPTED | 0.02 s | details |
#17 | ACCEPTED | 0.02 s | details |
#18 | ACCEPTED | 0.02 s | details |
#19 | ACCEPTED | 0.02 s | details |
#20 | ACCEPTED | 0.02 s | details |
#21 | ACCEPTED | 0.02 s | details |
#22 | ACCEPTED | 0.02 s | details |
#23 | ACCEPTED | 0.02 s | details |
#24 | ACCEPTED | 0.02 s | details |
#25 | ACCEPTED | 0.02 s | details |
#26 | ACCEPTED | 0.02 s | details |
#27 | ACCEPTED | 0.02 s | details |
#28 | ACCEPTED | 0.02 s | details |
#29 | ACCEPTED | 0.02 s | details |
#30 | ACCEPTED | 0.02 s | details |
#31 | ACCEPTED | 0.02 s | details |
#32 | ACCEPTED | 0.02 s | details |
#33 | ACCEPTED | 0.02 s | details |
#34 | ACCEPTED | 0.02 s | details |
#35 | ACCEPTED | 0.02 s | details |
#36 | ACCEPTED | 0.02 s | details |
#37 | ACCEPTED | 0.02 s | details |
#38 | ACCEPTED | 0.02 s | details |
#39 | ACCEPTED | 0.02 s | details |
#40 | ACCEPTED | 0.02 s | details |
#41 | ACCEPTED | 0.02 s | details |
#42 | ACCEPTED | 0.03 s | details |
#43 | ACCEPTED | 0.03 s | details |
#44 | ACCEPTED | 0.03 s | details |
#45 | ACCEPTED | 0.03 s | details |
#46 | ACCEPTED | 0.03 s | details |
#47 | ACCEPTED | 0.03 s | details |
#48 | ACCEPTED | 0.03 s | details |
#49 | ACCEPTED | 0.03 s | details |
#50 | ACCEPTED | 0.03 s | details |
#51 | ACCEPTED | 0.03 s | details |
#52 | ACCEPTED | 0.22 s | details |
#53 | ACCEPTED | 0.21 s | details |
#54 | ACCEPTED | 0.21 s | details |
#55 | ACCEPTED | 0.22 s | details |
#56 | ACCEPTED | 0.22 s | details |
#57 | ACCEPTED | 0.23 s | details |
#58 | ACCEPTED | 0.22 s | details |
#59 | ACCEPTED | 0.22 s | details |
#60 | ACCEPTED | 0.22 s | details |
#61 | ACCEPTED | 0.21 s | details |
#62 | TIME LIMIT EXCEEDED | -- | details |
#63 | TIME LIMIT EXCEEDED | -- | details |
#64 | TIME LIMIT EXCEEDED | -- | details |
#65 | TIME LIMIT EXCEEDED | -- | details |
#66 | TIME LIMIT EXCEEDED | -- | details |
#67 | TIME LIMIT EXCEEDED | -- | details |
#68 | TIME LIMIT EXCEEDED | -- | details |
#69 | TIME LIMIT EXCEEDED | -- | details |
#70 | TIME LIMIT EXCEEDED | -- | details |
#71 | TIME LIMIT EXCEEDED | -- | details |
#72 | TIME LIMIT EXCEEDED | -- | details |
#73 | TIME LIMIT EXCEEDED | -- | details |
Code
def max_pyramid_height(n, boxes): boxes.sort() tab = [0] * n for i in range(n): tab[i] = boxes[i][2] for i in range(n): for j in range(i): if boxes[j][0] <= boxes[i][0] and boxes[j][1] <= boxes[i][1]: tab[i] = max(tab[i], tab[j] + boxes[i][2]) return max(tab) n = int(input()) boxes = [tuple(map(int, input().split())) for _ in range(n)] print(max_pyramid_height(n, boxes))
Test details
Test 1
Verdict: ACCEPTED
input |
---|
1 7 8 3 |
correct output |
---|
3 |
user output |
---|
3 |
Test 2
Verdict: ACCEPTED
input |
---|
2 6 5 4 1 1 1 |
correct output |
---|
5 |
user output |
---|
5 |
Test 3
Verdict: ACCEPTED
input |
---|
2 3 6 7 9 7 10 |
correct output |
---|
17 |
user output |
---|
17 |
Test 4
Verdict: ACCEPTED
input |
---|
2 5 1 3 8 5 9 |
correct output |
---|
12 |
user output |
---|
12 |
Test 5
Verdict: ACCEPTED
input |
---|
3 7 7 4 2 6 9 2 5 2 |
correct output |
---|
15 |
user output |
---|
15 |
Test 6
Verdict: ACCEPTED
input |
---|
3 8 2 9 9 6 8 7 7 3 |
correct output |
---|
17 |
user output |
---|
17 |
Test 7
Verdict: ACCEPTED
input |
---|
3 1 6 6 5 1 9 10 6 10 |
correct output |
---|
19 |
user output |
---|
19 |
Test 8
Verdict: ACCEPTED
input |
---|
4 1 2 1 7 8 3 3 4 8 6 6 3 |
correct output |
---|
15 |
user output |
---|
15 |
Test 9
Verdict: ACCEPTED
input |
---|
4 8 2 9 9 6 8 7 7 3 1 6 4 |
correct output |
---|
17 |
user output |
---|
17 |
Test 10
Verdict: ACCEPTED
input |
---|
4 1 2 3 5 2 10 6 2 5 7 3 6 |
correct output |
---|
24 |
user output |
---|
24 |
Test 11
Verdict: ACCEPTED
input |
---|
4 9 7 7 3 8 3 2 2 10 10 7 4 |
correct output |
---|
21 |
user output |
---|
21 |
Test 12
Verdict: ACCEPTED
input |
---|
5 6 6 8 9 7 9 6 9 5 7 7 4 ... |
correct output |
---|
30 |
user output |
---|
30 |
Test 13
Verdict: ACCEPTED
input |
---|
5 5 10 8 10 1 2 4 10 2 3 1 4 ... |
correct output |
---|
14 |
user output |
---|
14 |
Test 14
Verdict: ACCEPTED
input |
---|
5 5 2 1 10 6 10 5 5 5 4 4 2 ... |
correct output |
---|
17 |
user output |
---|
17 |
Test 15
Verdict: ACCEPTED
input |
---|
5 6 1 8 9 3 2 6 6 9 5 9 1 ... |
correct output |
---|
20 |
user output |
---|
20 |
Test 16
Verdict: ACCEPTED
input |
---|
5 10 10 6 2 10 9 8 7 7 6 3 2 ... |
correct output |
---|
15 |
user output |
---|
15 |
Test 17
Verdict: ACCEPTED
input |
---|
5 3 1 9 9 3 4 10 10 5 1 7 4 ... |
correct output |
---|
20 |
user output |
---|
20 |
Test 18
Verdict: ACCEPTED
input |
---|
5 9 10 4 3 9 1 1 4 2 10 6 1 ... |
correct output |
---|
11 |
user output |
---|
11 |
Test 19
Verdict: ACCEPTED
input |
---|
5 1 3 8 4 5 10 8 5 10 4 6 3 ... |
correct output |
---|
28 |
user output |
---|
28 |
Test 20
Verdict: ACCEPTED
input |
---|
5 9 1 10 3 9 4 6 9 3 5 1 7 ... |
correct output |
---|
17 |
user output |
---|
17 |
Test 21
Verdict: ACCEPTED
input |
---|
5 1 4 6 5 5 1 2 4 2 1 3 9 ... |
correct output |
---|
18 |
user output |
---|
18 |
Test 22
Verdict: ACCEPTED
input |
---|
10 6 6 8 9 7 9 6 9 5 7 7 4 ... |
correct output |
---|
41 |
user output |
---|
41 |
Test 23
Verdict: ACCEPTED
input |
---|
10 5 10 8 10 1 2 4 10 2 3 1 4 ... |
correct output |
---|
35 |
user output |
---|
35 |
Test 24
Verdict: ACCEPTED
input |
---|
10 5 2 1 10 6 10 5 5 5 4 4 2 ... |
correct output |
---|
33 |
user output |
---|
33 |
Test 25
Verdict: ACCEPTED
input |
---|
10 6 1 8 9 3 2 6 6 9 5 9 1 ... |
correct output |
---|
21 |
user output |
---|
21 |
Test 26
Verdict: ACCEPTED
input |
---|
10 10 10 6 2 10 9 8 7 7 6 3 2 ... |
correct output |
---|
36 |
user output |
---|
36 |
Test 27
Verdict: ACCEPTED
input |
---|
10 3 1 9 9 3 4 10 10 5 1 7 4 ... |
correct output |
---|
37 |
user output |
---|
37 |
Test 28
Verdict: ACCEPTED
input |
---|
10 9 10 4 3 9 1 1 4 2 10 6 1 ... |
correct output |
---|
25 |
user output |
---|
25 |
Test 29
Verdict: ACCEPTED
input |
---|
10 1 3 8 4 5 10 8 5 10 4 6 3 ... |
correct output |
---|
33 |
user output |
---|
33 |
Test 30
Verdict: ACCEPTED
input |
---|
10 9 1 10 3 9 4 6 9 3 5 1 7 ... |
correct output |
---|
28 |
user output |
---|
28 |
Test 31
Verdict: ACCEPTED
input |
---|
10 1 4 6 5 5 1 2 4 2 1 3 9 ... |
correct output |
---|
29 |
user output |
---|
29 |
Test 32
Verdict: ACCEPTED
input |
---|
100 589284012 636562060 767928734 906523441 647212241 921212095 585063857 909729626 454895875 669546421 693523526 412726717 ... |
correct output |
---|
10998205207 |
user output |
---|
10998205207 |
Test 33
Verdict: ACCEPTED
input |
---|
100 447773962 773442532 122816 137572579 324627123 157577940 253498609 99147813 425825313 199995380 416515986 371043004 ... |
correct output |
---|
8897447989 |
user output |
---|
8897447989 |
Test 34
Verdict: ACCEPTED
input |
---|
100 468145963 198730372 27838076 590195590 467423861 520495379 451366491 344173378 354694313 165814381 219739800 750398099 ... |
correct output |
---|
9141888792 |
user output |
---|
9141888792 |
Test 35
Verdict: ACCEPTED
input |
---|
100 591414747 75940263 760367935 901888417 312356591 130275571 548496961 611293382 958794496 469291685 962387379 20130523 ... |
correct output |
---|
10698400685 |
user output |
---|
10698400685 |
Test 36
Verdict: ACCEPTED
input |
---|
100 967034924 587586158 185430194 918715995 767527830 653946995 749180621 641621091 232024335 151896000 241061404 6689688 ... |
correct output |
---|
12833486742 |
user output |
---|
12833486742 |
Test 37
Verdict: ACCEPTED
input |
---|
100 238363353 59249204 934941692 892631472 221963002 390559518 986350949 524427523 96444602 656854970 425992688 822387303 ... |
correct output |
---|
11001071375 |
user output |
---|
11001071375 |
Test 38
Verdict: ACCEPTED
input |
---|
100 958701283 356460601 224848374 881788059 68992860 44771412 397401947 115595477 638932295 106806913 568887059 653343572 ... |
correct output |
---|
8425454448 |
user output |
---|
8425454448 |
Test 39
Verdict: ACCEPTED
input |
---|
100 81935404 244103474 837431431 342493822 470738321 776814822 489180570 330726191 578205540 283329158 538074003 93140055 ... |
correct output |
---|
10342518662 |
user output |
---|
10342518662 |
Test 40
Verdict: ACCEPTED
input |
---|
100 937837681 11934038 257096283 933290530 405355767 570001955 876668629 249890139 453495728 12239373 657165788 462212374 ... |
correct output |
---|
8144852495 |
user output |
---|
8144852495 |
Test 41
Verdict: ACCEPTED
input |
---|
100 11139168 391337048 538883744 535937150 532332526 8099343 143698367 339543270 152590624 14304401 234675590 941909102 ... |
correct output |
---|
9522402349 |
user output |
---|
9522402349 |
Test 42
Verdict: ACCEPTED
input |
---|
200 589284012 636562060 767928734 906523441 647212241 921212095 585063857 909729626 454895875 669546421 693523526 412726717 ... |
correct output |
---|
15209742885 |
user output |
---|
15209742885 |
Test 43
Verdict: ACCEPTED
input |
---|
200 447773962 773442532 122816 137572579 324627123 157577940 253498609 99147813 425825313 199995380 416515986 371043004 ... |
correct output |
---|
13615506574 |
user output |
---|
13615506574 |
Test 44
Verdict: ACCEPTED
input |
---|
200 468145963 198730372 27838076 590195590 467423861 520495379 451366491 344173378 354694313 165814381 219739800 750398099 ... |
correct output |
---|
12798974974 |
user output |
---|
12798974974 |
Test 45
Verdict: ACCEPTED
input |
---|
200 591414747 75940263 760367935 901888417 312356591 130275571 548496961 611293382 958794496 469291685 962387379 20130523 ... |
correct output |
---|
15137965961 |
user output |
---|
15137965961 |
Test 46
Verdict: ACCEPTED
input |
---|
200 967034924 587586158 185430194 918715995 767527830 653946995 749180621 641621091 232024335 151896000 241061404 6689688 ... |
correct output |
---|
17343709538 |
user output |
---|
17343709538 |
Test 47
Verdict: ACCEPTED
input |
---|
200 238363353 59249204 934941692 892631472 221963002 390559518 986350949 524427523 96444602 656854970 425992688 822387303 ... |
correct output |
---|
16484729704 |
user output |
---|
16484729704 |
Test 48
Verdict: ACCEPTED
input |
---|
200 958701283 356460601 224848374 881788059 68992860 44771412 397401947 115595477 638932295 106806913 568887059 653343572 ... |
correct output |
---|
13668103642 |
user output |
---|
13668103642 |
Test 49
Verdict: ACCEPTED
input |
---|
200 81935404 244103474 837431431 342493822 470738321 776814822 489180570 330726191 578205540 283329158 538074003 93140055 ... |
correct output |
---|
12761842389 |
user output |
---|
12761842389 |
Test 50
Verdict: ACCEPTED
input |
---|
200 937837681 11934038 257096283 933290530 405355767 570001955 876668629 249890139 453495728 12239373 657165788 462212374 ... |
correct output |
---|
13061107314 |
user output |
---|
13061107314 |
Test 51
Verdict: ACCEPTED
input |
---|
200 11139168 391337048 538883744 535937150 532332526 8099343 143698367 339543270 152590624 14304401 234675590 941909102 ... |
correct output |
---|
14114713109 |
user output |
---|
14114713109 |
Test 52
Verdict: ACCEPTED
input |
---|
1000 589284012 636562060 767928734 906523441 647212241 921212095 585063857 909729626 454895875 669546421 693523526 412726717 ... |
correct output |
---|
33891762384 |
user output |
---|
33891762384 |
Test 53
Verdict: ACCEPTED
input |
---|
1000 447773962 773442532 122816 137572579 324627123 157577940 253498609 99147813 425825313 199995380 416515986 371043004 ... |
correct output |
---|
33355847789 |
user output |
---|
33355847789 |
Test 54
Verdict: ACCEPTED
input |
---|
1000 468145963 198730372 27838076 590195590 467423861 520495379 451366491 344173378 354694313 165814381 219739800 750398099 ... |
correct output |
---|
33709682513 |
user output |
---|
33709682513 |
Test 55
Verdict: ACCEPTED
input |
---|
1000 591414747 75940263 760367935 901888417 312356591 130275571 548496961 611293382 958794496 469291685 962387379 20130523 ... |
correct output |
---|
34006550890 |
user output |
---|
34006550890 |
Test 56
Verdict: ACCEPTED
input |
---|
1000 967034924 587586158 185430194 918715995 767527830 653946995 749180621 641621091 232024335 151896000 241061404 6689688 ... |
correct output |
---|
34976444698 |
user output |
---|
34976444698 |
Test 57
Verdict: ACCEPTED
input |
---|
1000 238363353 59249204 934941692 892631472 221963002 390559518 986350949 524427523 96444602 656854970 425992688 822387303 ... |
correct output |
---|
34699884028 |
user output |
---|
34699884028 |
Test 58
Verdict: ACCEPTED
input |
---|
1000 958701283 356460601 224848374 881788059 68992860 44771412 397401947 115595477 638932295 106806913 568887059 653343572 ... |
correct output |
---|
34046313943 |
user output |
---|
34046313943 |
Test 59
Verdict: ACCEPTED
input |
---|
1000 81935404 244103474 837431431 342493822 470738321 776814822 489180570 330726191 578205540 283329158 538074003 93140055 ... |
correct output |
---|
33580356050 |
user output |
---|
33580356050 |
Test 60
Verdict: ACCEPTED
input |
---|
1000 937837681 11934038 257096283 933290530 405355767 570001955 876668629 249890139 453495728 12239373 657165788 462212374 ... |
correct output |
---|
35744107623 |
user output |
---|
35744107623 |
Test 61
Verdict: ACCEPTED
input |
---|
1000 11139168 391337048 538883744 535937150 532332526 8099343 143698367 339543270 152590624 14304401 234675590 941909102 ... |
correct output |
---|
35345712189 |
user output |
---|
35345712189 |
Test 62
Verdict: TIME LIMIT EXCEEDED
input |
---|
200000 589284012 636562060 767928734 906523441 647212241 921212095 585063857 909729626 454895875 669546421 693523526 412726717 ... |
correct output |
---|
526570534463 |
user output |
---|
(empty) |
Test 63
Verdict: TIME LIMIT EXCEEDED
input |
---|
200000 447773962 773442532 122816 137572579 324627123 157577940 253498609 99147813 425825313 199995380 416515986 371043004 ... |
correct output |
---|
527468957174 |
user output |
---|
(empty) |
Test 64
Verdict: TIME LIMIT EXCEEDED
input |
---|
200000 468145963 198730372 27838076 590195590 467423861 520495379 451366491 344173378 354694313 165814381 219739800 750398099 ... |
correct output |
---|
530364449483 |
user output |
---|
(empty) |
Test 65
Verdict: TIME LIMIT EXCEEDED
input |
---|
200000 591414747 75940263 760367935 901888417 312356591 130275571 548496961 611293382 958794496 469291685 962387379 20130523 ... |
correct output |
---|
531529346089 |
user output |
---|
(empty) |
Test 66
Verdict: TIME LIMIT EXCEEDED
input |
---|
200000 967034924 587586158 185430194 918715995 767527830 653946995 749180621 641621091 232024335 151896000 241061404 6689688 ... |
correct output |
---|
532748830637 |
user output |
---|
(empty) |
Test 67
Verdict: TIME LIMIT EXCEEDED
input |
---|
200000 238363353 59249204 934941692 892631472 221963002 390559518 986350949 524427523 96444602 656854970 425992688 822387303 ... |
correct output |
---|
525080370284 |
user output |
---|
(empty) |
Test 68
Verdict: TIME LIMIT EXCEEDED
input |
---|
200000 958701283 356460601 224848374 881788059 68992860 44771412 397401947 115595477 638932295 106806913 568887059 653343572 ... |
correct output |
---|
529566966249 |
user output |
---|
(empty) |
Test 69
Verdict: TIME LIMIT EXCEEDED
input |
---|
200000 81935404 244103474 837431431 342493822 470738321 776814822 489180570 330726191 578205540 283329158 538074003 93140055 ... |
correct output |
---|
521546866708 |
user output |
---|
(empty) |
Test 70
Verdict: TIME LIMIT EXCEEDED
input |
---|
200000 937837681 11934038 257096283 933290530 405355767 570001955 876668629 249890139 453495728 12239373 657165788 462212374 ... |
correct output |
---|
531573800077 |
user output |
---|
(empty) |
Test 71
Verdict: TIME LIMIT EXCEEDED
input |
---|
200000 11139168 391337048 538883744 535937150 532332526 8099343 143698367 339543270 152590624 14304401 234675590 941909102 ... |
correct output |
---|
529286403784 |
user output |
---|
(empty) |
Test 72
Verdict: TIME LIMIT EXCEEDED
input |
---|
200000 1000000000 1000000000 10000000... |
correct output |
---|
200000000000000 |
user output |
---|
(empty) |
Test 73
Verdict: TIME LIMIT EXCEEDED
input |
---|
200000 1000000000 1 1 1000000000 2 2 1000000000 3 3 1000000000 4 4 ... |
correct output |
---|
20000100000 |
user output |
---|
(empty) |