Task: | Box stack I |
Sender: | aalto2024c_009 |
Submission time: | 2024-09-18 17:00:15 +0300 |
Language: | C++ (C++11) |
Status: | READY |
Result: | WRONG ANSWER |
test | verdict | time | |
---|---|---|---|
#1 | ACCEPTED | 0.00 s | details |
#2 | WRONG ANSWER | 0.00 s | details |
#3 | ACCEPTED | 0.00 s | details |
#4 | ACCEPTED | 0.00 s | details |
#5 | WRONG ANSWER | 0.00 s | details |
#6 | WRONG ANSWER | 0.00 s | details |
#7 | WRONG ANSWER | 0.00 s | details |
#8 | WRONG ANSWER | 0.00 s | details |
#9 | ACCEPTED | 0.00 s | details |
#10 | ACCEPTED | 0.00 s | details |
#11 | WRONG ANSWER | 0.00 s | details |
#12 | WRONG ANSWER | 0.00 s | details |
#13 | WRONG ANSWER | 0.00 s | details |
#14 | ACCEPTED | 0.00 s | details |
#15 | WRONG ANSWER | 0.00 s | details |
#16 | WRONG ANSWER | 0.00 s | details |
#17 | WRONG ANSWER | 0.00 s | details |
#18 | ACCEPTED | 0.00 s | details |
#19 | WRONG ANSWER | 0.00 s | details |
#20 | WRONG ANSWER | 0.00 s | details |
#21 | WRONG ANSWER | 0.00 s | details |
#22 | WRONG ANSWER | 0.00 s | details |
#23 | WRONG ANSWER | 0.00 s | details |
#24 | WRONG ANSWER | 0.00 s | details |
#25 | WRONG ANSWER | 0.00 s | details |
#26 | ACCEPTED | 0.00 s | details |
#27 | WRONG ANSWER | 0.00 s | details |
#28 | ACCEPTED | 0.00 s | details |
#29 | WRONG ANSWER | 0.00 s | details |
#30 | WRONG ANSWER | 0.00 s | details |
#31 | WRONG ANSWER | 0.00 s | details |
#32 | WRONG ANSWER | 0.00 s | details |
#33 | WRONG ANSWER | 0.00 s | details |
#34 | WRONG ANSWER | 0.00 s | details |
#35 | WRONG ANSWER | 0.00 s | details |
#36 | WRONG ANSWER | 0.00 s | details |
#37 | WRONG ANSWER | 0.00 s | details |
#38 | WRONG ANSWER | 0.00 s | details |
#39 | WRONG ANSWER | 0.00 s | details |
#40 | WRONG ANSWER | 0.00 s | details |
#41 | WRONG ANSWER | 0.00 s | details |
#42 | WRONG ANSWER | 0.00 s | details |
#43 | WRONG ANSWER | 0.00 s | details |
#44 | WRONG ANSWER | 0.00 s | details |
#45 | WRONG ANSWER | 0.00 s | details |
#46 | WRONG ANSWER | 0.00 s | details |
#47 | WRONG ANSWER | 0.00 s | details |
#48 | WRONG ANSWER | 0.00 s | details |
#49 | WRONG ANSWER | 0.00 s | details |
#50 | WRONG ANSWER | 0.00 s | details |
#51 | WRONG ANSWER | 0.01 s | details |
#52 | WRONG ANSWER | 0.01 s | details |
#53 | WRONG ANSWER | 0.01 s | details |
#54 | WRONG ANSWER | 0.01 s | details |
#55 | WRONG ANSWER | 0.01 s | details |
#56 | WRONG ANSWER | 0.01 s | details |
#57 | WRONG ANSWER | 0.01 s | details |
#58 | WRONG ANSWER | 0.01 s | details |
#59 | WRONG ANSWER | 0.01 s | details |
#60 | WRONG ANSWER | 0.01 s | details |
Code
#include <iostream> #include <vector> using namespace std; struct S{ int w; int c; int h; }; int main(){ int n; cin>>n; vector<S> caixes(n); for(int i=0; i<n; i++){ int w,c,h; cin >> w >> c >> h; S a; a.w = w; a.c = c; a.h = h; caixes[i] = a; } vector<S> solution(n); if(n!=0){ solution[0]=caixes[0]; } for(int i=1; i<n; i++){ S a = caixes[i]; int w = a.w; int max_c = a.c; int h = a.h; for(int l=i-1; l>=0; l--){ if(solution[l].w<=max_c and (solution[l].h + a.h)>h){ w = solution[l].w + a.w; h = solution[l].h + a.h; } } if(solution[i-1].h>h){ solution[i]=solution[i-1]; } else{ S f; f.w = w; f.c = max_c; f.h = h; solution[i] = f; } } cout << solution[n-1].h << endl; for(int i=0; i<n ; i++){ cout << solution[i].h << " "; } cout<<endl; }
Test details
Test 1
Verdict: ACCEPTED
input |
---|
1 6 7 10 |
correct output |
---|
10 |
user output |
---|
10 10 |
Test 2
Verdict: WRONG ANSWER
input |
---|
2 5 2 4 1 2 10 |
correct output |
---|
14 |
user output |
---|
10 4 10 |
Test 3
Verdict: ACCEPTED
input |
---|
2 8 2 3 3 8 5 |
correct output |
---|
8 |
user output |
---|
8 3 8 |
Test 4
Verdict: ACCEPTED
input |
---|
3 7 3 6 10 8 9 3 6 2 |
correct output |
---|
15 |
user output |
---|
15 6 15 15 |
Test 5
Verdict: WRONG ANSWER
input |
---|
3 9 6 9 4 4 6 7 2 7 |
correct output |
---|
15 |
user output |
---|
9 9 9 9 |
Test 6
Verdict: WRONG ANSWER
input |
---|
3 10 7 6 3 2 8 2 1 9 |
correct output |
---|
23 |
user output |
---|
9 6 8 9 |
Test 7
Verdict: WRONG ANSWER
input |
---|
4 8 4 2 3 4 10 5 10 5 2 6 2 |
correct output |
---|
17 |
user output |
---|
15 2 10 15 15 |
Test 8
Verdict: WRONG ANSWER
input |
---|
4 3 6 5 1 1 10 10 9 5 4 8 6 |
correct output |
---|
26 |
user output |
---|
16 5 10 15 16 |
Test 9
Verdict: ACCEPTED
input |
---|
4 7 3 6 10 5 9 6 10 1 6 7 1 |
correct output |
---|
10 |
user output |
---|
10 6 9 10 10 |
Test 10
Verdict: ACCEPTED
input |
---|
4 8 1 6 2 7 7 9 6 2 5 2 10 |
correct output |
---|
17 |
user output |
---|
17 6 7 9 17 |
Test 11
Verdict: WRONG ANSWER
input |
---|
5 6 6 8 9 7 9 6 9 5 7 7 4 ... |
correct output |
---|
18 |
user output |
---|
17 8 17 17 17 17 |
Test 12
Verdict: WRONG ANSWER
input |
---|
5 5 10 8 10 1 2 4 10 2 3 1 4 ... |
correct output |
---|
18 |
user output |
---|
10 8 8 10 10 10 |
Test 13
Verdict: WRONG ANSWER
input |
---|
5 5 2 1 10 6 10 5 5 5 4 4 2 ... |
correct output |
---|
17 |
user output |
---|
11 1 11 11 11 11 |
Test 14
Verdict: ACCEPTED
input |
---|
5 6 1 8 9 3 2 6 6 9 5 9 1 ... |
correct output |
---|
17 |
user output |
---|
17 8 8 17 17 17 |
Test 15
Verdict: WRONG ANSWER
input |
---|
5 10 10 6 2 10 9 8 7 7 6 3 2 ... |
correct output |
---|
22 |
user output |
---|
15 6 15 15 15 15 |
Test 16
Verdict: WRONG ANSWER
input |
---|
5 3 1 9 9 3 4 10 10 5 1 7 4 ... |
correct output |
---|
19 |
user output |
---|
15 9 13 14 14 15 |
Test 17
Verdict: WRONG ANSWER
input |
---|
5 9 10 4 3 9 1 1 4 2 10 6 1 ... |
correct output |
---|
12 |
user output |
---|
5 4 5 5 5 5 |
Test 18
Verdict: ACCEPTED
input |
---|
5 1 3 8 4 5 10 8 5 10 4 6 3 ... |
correct output |
---|
28 |
user output |
---|
28 8 18 28 28 28 |
Test 19
Verdict: WRONG ANSWER
input |
---|
5 9 1 10 3 9 4 6 9 3 5 1 7 ... |
correct output |
---|
16 |
user output |
---|
14 10 14 14 14 14 |
Test 20
Verdict: WRONG ANSWER
input |
---|
5 1 4 6 5 5 1 2 4 2 1 3 9 ... |
correct output |
---|
18 |
user output |
---|
17 6 7 8 17 17 |
Test 21
Verdict: WRONG ANSWER
input |
---|
10 6 6 8 9 7 9 6 9 5 7 7 4 ... |
correct output |
---|
22 |
user output |
---|
17 8 17 17 17 17 17 17 17 17 17 |
Test 22
Verdict: WRONG ANSWER
input |
---|
10 5 10 8 10 1 2 4 10 2 3 1 4 ... |
correct output |
---|
29 |
user output |
---|
17 8 8 10 10 10 10 15 16 17 17 |
Test 23
Verdict: WRONG ANSWER
input |
---|
10 5 2 1 10 6 10 5 5 5 4 4 2 ... |
correct output |
---|
25 |
user output |
---|
11 1 11 11 11 11 11 11 11 11 11 |
Test 24
Verdict: WRONG ANSWER
input |
---|
10 6 1 8 9 3 2 6 6 9 5 9 1 ... |
correct output |
---|
19 |
user output |
---|
17 8 8 17 17 17 17 17 17 17 17 |
Test 25
Verdict: WRONG ANSWER
input |
---|
10 10 10 6 2 10 9 8 7 7 6 3 2 ... |
correct output |
---|
31 |
user output |
---|
15 6 15 15 15 15 15 15 15 15 15 |
Test 26
Verdict: ACCEPTED
input |
---|
10 3 1 9 9 3 4 10 10 5 1 7 4 ... |
correct output |
---|
28 |
user output |
---|
28 9 13 14 14 15 19 20 28 28 28 |
Test 27
Verdict: WRONG ANSWER
input |
---|
10 9 10 4 3 9 1 1 4 2 10 6 1 ... |
correct output |
---|
21 |
user output |
---|
13 4 5 5 5 5 5 10 10 10 13 |
Test 28
Verdict: ACCEPTED
input |
---|
10 1 3 8 4 5 10 8 5 10 4 6 3 ... |
correct output |
---|
28 |
user output |
---|
28 8 18 28 28 28 28 28 28 28 28 |
Test 29
Verdict: WRONG ANSWER
input |
---|
10 9 1 10 3 9 4 6 9 3 5 1 7 ... |
correct output |
---|
27 |
user output |
---|
16 10 14 14 14 14 14 16 16 16 16 |
Test 30
Verdict: WRONG ANSWER
input |
---|
10 1 4 6 5 5 1 2 4 2 1 3 9 ... |
correct output |
---|
29 |
user output |
---|
25 6 7 8 17 17 17 19 23 23 25 |
Test 31
Verdict: WRONG ANSWER
input |
---|
100 1098 1186 1431 1689 1206 1716 1090 1695 848 1248 1292 769 ... |
correct output |
---|
16023 |
user output |
---|
5299 1431 3147 3147 3147 3147 3147 ... Truncated |
Test 32
Verdict: WRONG ANSWER
input |
---|
100 835 1995 1441 1866 1 257 605 1999 294 473 185 794 ... |
correct output |
---|
16049 |
user output |
---|
5176 1441 1441 1735 1735 1735 1872 ... Truncated |
Test 33
Verdict: WRONG ANSWER
input |
---|
100 872 371 52 1864 1100 1896 871 970 841 642 661 309 ... |
correct output |
---|
14165 |
user output |
---|
5509 52 1948 1948 1948 1948 1948 19... Truncated |
Test 34
Verdict: WRONG ANSWER
input |
---|
100 1102 142 1417 1680 582 243 1022 1139 1786 875 1793 38 ... |
correct output |
---|
12391 |
user output |
---|
5248 1417 1417 3203 3203 3203 3203 ... Truncated |
Test 35
Verdict: WRONG ANSWER
input |
---|
100 1935 1802 1095 346 1946 1712 1430 1219 1396 1196 433 283 ... |
correct output |
---|
19385 |
user output |
---|
2877 1095 2807 2807 2807 2807 2807 ... Truncated |
Test 36
Verdict: WRONG ANSWER
input |
---|
100 444 111 1742 1663 414 728 1838 1959 977 180 1224 794 ... |
correct output |
---|
15364 |
user output |
---|
5692 1742 1742 2719 2719 2779 3724 ... Truncated |
Test 37
Verdict: WRONG ANSWER
input |
---|
100 1786 1895 664 419 1643 129 84 741 216 1971 1191 199 ... |
correct output |
---|
15648 |
user output |
---|
4394 664 664 664 664 838 966 1843 1... Truncated |
Test 38
Verdict: WRONG ANSWER
input |
---|
100 153 455 1560 638 877 1957 1447 912 1956 617 1077 528 ... |
correct output |
---|
12527 |
user output |
---|
7177 1560 3517 5473 5473 5473 5473 ... Truncated |
Test 39
Verdict: WRONG ANSWER
input |
---|
100 1747 23 1938 479 1739 756 1062 1633 466 845 23 1225 ... |
correct output |
---|
12817 |
user output |
---|
3688 1938 1938 1938 1938 1938 1938 ... Truncated |
Test 40
Verdict: WRONG ANSWER
input |
---|
100 21 729 1004 999 992 16 268 633 285 27 438 1755 ... |
correct output |
---|
15927 |
user output |
---|
8224 1004 1020 1289 3044 3044 3044 ... Truncated |
Test 41
Verdict: WRONG ANSWER
input |
---|
200 1098 1186 1431 1689 1206 1716 1090 1695 848 1248 1292 769 ... |
correct output |
---|
20991 |
user output |
---|
5299 1431 3147 3147 3147 3147 3147 ... Truncated |
Test 42
Verdict: WRONG ANSWER
input |
---|
200 835 1995 1441 1866 1 257 605 1999 294 473 185 794 ... |
correct output |
---|
24785 |
user output |
---|
5176 1441 1441 1735 1735 1735 1872 ... Truncated |
Test 43
Verdict: WRONG ANSWER
input |
---|
200 872 371 52 1864 1100 1896 871 970 841 642 661 309 ... |
correct output |
---|
20005 |
user output |
---|
5509 52 1948 1948 1948 1948 1948 19... Truncated |
Test 44
Verdict: WRONG ANSWER
input |
---|
200 1102 142 1417 1680 582 243 1022 1139 1786 875 1793 38 ... |
correct output |
---|
21655 |
user output |
---|
5355 1417 1417 3203 3203 3203 3203 ... Truncated |
Test 45
Verdict: WRONG ANSWER
input |
---|
200 1935 1802 1095 346 1946 1712 1430 1219 1396 1196 433 283 ... |
correct output |
---|
24716 |
user output |
---|
2975 1095 2807 2807 2807 2807 2807 ... Truncated |
Test 46
Verdict: WRONG ANSWER
input |
---|
200 444 111 1742 1663 414 728 1838 1959 977 180 1224 794 ... |
correct output |
---|
20753 |
user output |
---|
5808 1742 1742 2719 2719 2779 3724 ... Truncated |
Test 47
Verdict: WRONG ANSWER
input |
---|
200 1786 1895 664 419 1643 129 84 741 216 1971 1191 199 ... |
correct output |
---|
25462 |
user output |
---|
4394 664 664 664 664 838 966 1843 1... Truncated |
Test 48
Verdict: WRONG ANSWER
input |
---|
200 153 455 1560 638 877 1957 1447 912 1956 617 1077 528 ... |
correct output |
---|
19588 |
user output |
---|
8891 1560 3517 5473 5473 5473 5473 ... Truncated |
Test 49
Verdict: WRONG ANSWER
input |
---|
200 1747 23 1938 479 1739 756 1062 1633 466 845 23 1225 ... |
correct output |
---|
19995 |
user output |
---|
3908 1938 1938 1938 1938 1938 1938 ... Truncated |
Test 50
Verdict: WRONG ANSWER
input |
---|
200 21 729 1004 999 992 16 268 633 285 27 438 1755 ... |
correct output |
---|
26434 |
user output |
---|
8230 1004 1020 1289 3044 3044 3044 ... Truncated |
Test 51
Verdict: WRONG ANSWER
input |
---|
1000 1098 1186 1431 1689 1206 1716 1090 1695 848 1248 1292 769 ... |
correct output |
---|
51198 |
user output |
---|
5299 1431 3147 3147 3147 3147 3147 ... Truncated |
Test 52
Verdict: WRONG ANSWER
input |
---|
1000 835 1995 1441 1866 1 257 605 1999 294 473 185 794 ... |
correct output |
---|
49723 |
user output |
---|
10809 1441 1441 1735 1735 1735 1872 ... Truncated |
Test 53
Verdict: WRONG ANSWER
input |
---|
1000 872 371 52 1864 1100 1896 871 970 841 642 661 309 ... |
correct output |
---|
47760 |
user output |
---|
5862 52 1948 1948 1948 1948 1948 19... Truncated |
Test 54
Verdict: WRONG ANSWER
input |
---|
1000 1102 142 1417 1680 582 243 1022 1139 1786 875 1793 38 ... |
correct output |
---|
46095 |
user output |
---|
5404 1417 1417 3203 3203 3203 3203 ... Truncated |
Test 55
Verdict: WRONG ANSWER
input |
---|
1000 1935 1802 1095 346 1946 1712 1430 1219 1396 1196 433 283 ... |
correct output |
---|
55178 |
user output |
---|
2975 1095 2807 2807 2807 2807 2807 ... Truncated |
Test 56
Verdict: WRONG ANSWER
input |
---|
2000 444 111 1742 1663 414 728 1838 1959 977 180 1224 794 ... |
correct output |
---|
76003 |
user output |
---|
5876 1742 1742 2719 2719 2779 3724 ... Truncated |
Test 57
Verdict: WRONG ANSWER
input |
---|
2000 1786 1895 664 419 1643 129 84 741 216 1971 1191 199 ... |
correct output |
---|
69375 |
user output |
---|
4414 664 664 664 664 838 966 1843 1... Truncated |
Test 58
Verdict: WRONG ANSWER
input |
---|
2000 153 455 1560 638 877 1957 1447 912 1956 617 1077 528 ... |
correct output |
---|
68402 |
user output |
---|
9419 1560 3517 5473 5473 5473 5473 ... Truncated |
Test 59
Verdict: WRONG ANSWER
input |
---|
2000 1747 23 1938 479 1739 756 1062 1633 466 845 23 1225 ... |
correct output |
---|
76262 |
user output |
---|
3912 1938 1938 1938 1938 1938 1938 ... Truncated |
Test 60
Verdict: WRONG ANSWER
input |
---|
2000 21 729 1004 999 992 16 268 633 285 27 438 1755 ... |
correct output |
---|
81251 |
user output |
---|
8262 1004 1020 1289 3044 3044 3044 ... Truncated |