# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
20573 | 2017-02-12T11:42:00 Z | G(#74, gs12117) | Can polan into space? (OJUZ11_space) | C++11 | 156 ms | 10496 KB |
#include<stdio.h> int n; int a[200100][3]; long long int dp[200100][2]; int back[200100][2]; int gr[200100]; int ans[400100]; int anss, anse; int main() { scanf("%d", &n); for (int i = 0; i < n; i++) { scanf("%d%d%d", &a[i][0], &a[i][1], &a[i][2]); } dp[0][0] = a[0][0]; dp[0][1] = a[0][1]; for (int i = 1; i < n; i++) { dp[i][0] = dp[i - 1][0] + a[i][1]; back[i][0] = 0; if (dp[i][0] < dp[i - 1][1] + a[i][0]) { dp[i][0] = dp[i - 1][1] + a[i][0]; back[i][0] = 1; } dp[i][1] = dp[i - 1][0] + a[i][2]; back[i][1] = 0; if (dp[i][1] < dp[i - 1][1] + a[i][1]) { dp[i][1] = dp[i - 1][1] + a[i][1]; back[i][1] = 1; } } printf("%d\n", dp[n - 1][0]); int p = 0; for (int i = n - 1; i > 0; i--) { p = back[i][p]; gr[i] = p; } anss = n; anse = n; ans[n] = 0; for (int i = 1; i < n; i++) { if (gr[i] == 1) { anss--; ans[anss] = i; } else { anse++; ans[anse] = i; } } for (int i = anss; i <= anse; i++) { printf("%d ", ans[i] + 1); } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 10496 KB | Output is correct |
2 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
3 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
4 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
5 | Correct | 0 ms | 10496 KB | Output is correct |
6 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
7 | Correct | 0 ms | 10496 KB | Output is correct |
8 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
9 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
10 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
11 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
12 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
13 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
14 | Correct | 0 ms | 10496 KB | Output is correct |
15 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
16 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
17 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
18 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
19 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
20 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
21 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 10496 KB | Output is correct |
2 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
3 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
4 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
5 | Correct | 0 ms | 10496 KB | Output is correct |
6 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
7 | Correct | 0 ms | 10496 KB | Output is correct |
8 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
9 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
10 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
11 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
12 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
13 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
14 | Correct | 0 ms | 10496 KB | Output is correct |
15 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
16 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
17 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
18 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
19 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
20 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
21 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
22 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
23 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
24 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
25 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
26 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
27 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
28 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
29 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
30 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
31 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
32 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
33 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
34 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
35 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
36 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
37 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 10496 KB | Output is correct |
2 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
3 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
4 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
5 | Correct | 0 ms | 10496 KB | Output is correct |
6 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
7 | Correct | 0 ms | 10496 KB | Output is correct |
8 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
9 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
10 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
11 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
12 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
13 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
14 | Correct | 0 ms | 10496 KB | Output is correct |
15 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
16 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
17 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
18 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
19 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
20 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
21 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
22 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
23 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
24 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
25 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
26 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
27 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
28 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
29 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
30 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
31 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
32 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
33 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
34 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
35 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
36 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
37 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
38 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
39 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
40 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
41 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
42 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
43 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
44 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
45 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
46 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
47 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
48 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
49 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
50 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
51 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
52 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
53 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 10496 KB | Output is correct |
2 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
3 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
4 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
5 | Correct | 0 ms | 10496 KB | Output is correct |
6 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
7 | Correct | 0 ms | 10496 KB | Output is correct |
8 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
9 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
10 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
11 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
12 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
13 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
14 | Correct | 0 ms | 10496 KB | Output is correct |
15 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
16 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
17 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
18 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
19 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
20 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
21 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
22 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
23 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
24 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
25 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
26 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
27 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
28 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
29 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
30 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
31 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
32 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
33 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
34 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
35 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
36 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
37 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
38 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
39 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
40 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
41 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
42 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
43 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
44 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
45 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
46 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
47 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
48 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
49 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
50 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
51 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
52 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
53 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
54 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
55 | Incorrect | 6 ms | 10496 KB | Output isn't correct |
56 | Incorrect | 9 ms | 10496 KB | Output isn't correct |
57 | Incorrect | 6 ms | 10496 KB | Output isn't correct |
58 | Incorrect | 6 ms | 10496 KB | Output isn't correct |
59 | Incorrect | 3 ms | 10496 KB | Output isn't correct |
60 | Incorrect | 3 ms | 10496 KB | Output isn't correct |
61 | Incorrect | 3 ms | 10496 KB | Output isn't correct |
62 | Incorrect | 3 ms | 10496 KB | Output isn't correct |
63 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
64 | Incorrect | 3 ms | 10496 KB | Output isn't correct |
65 | Incorrect | 3 ms | 10496 KB | Output isn't correct |
66 | Incorrect | 6 ms | 10496 KB | Output isn't correct |
67 | Incorrect | 3 ms | 10496 KB | Output isn't correct |
68 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
69 | Incorrect | 9 ms | 10496 KB | Output isn't correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 10496 KB | Output is correct |
2 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
3 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
4 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
5 | Correct | 0 ms | 10496 KB | Output is correct |
6 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
7 | Correct | 0 ms | 10496 KB | Output is correct |
8 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
9 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
10 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
11 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
12 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
13 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
14 | Correct | 0 ms | 10496 KB | Output is correct |
15 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
16 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
17 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
18 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
19 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
20 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
21 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
22 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
23 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
24 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
25 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
26 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
27 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
28 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
29 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
30 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
31 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
32 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
33 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
34 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
35 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
36 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
37 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
38 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
39 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
40 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
41 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
42 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
43 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
44 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
45 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
46 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
47 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
48 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
49 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
50 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
51 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
52 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
53 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
54 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
55 | Incorrect | 6 ms | 10496 KB | Output isn't correct |
56 | Incorrect | 9 ms | 10496 KB | Output isn't correct |
57 | Incorrect | 6 ms | 10496 KB | Output isn't correct |
58 | Incorrect | 6 ms | 10496 KB | Output isn't correct |
59 | Incorrect | 3 ms | 10496 KB | Output isn't correct |
60 | Incorrect | 3 ms | 10496 KB | Output isn't correct |
61 | Incorrect | 3 ms | 10496 KB | Output isn't correct |
62 | Incorrect | 3 ms | 10496 KB | Output isn't correct |
63 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
64 | Incorrect | 3 ms | 10496 KB | Output isn't correct |
65 | Incorrect | 3 ms | 10496 KB | Output isn't correct |
66 | Incorrect | 6 ms | 10496 KB | Output isn't correct |
67 | Incorrect | 3 ms | 10496 KB | Output isn't correct |
68 | Incorrect | 0 ms | 10496 KB | Output isn't correct |
69 | Incorrect | 9 ms | 10496 KB | Output isn't correct |
70 | Incorrect | 6 ms | 10496 KB | Output isn't correct |
71 | Incorrect | 156 ms | 10496 KB | Output isn't correct |
72 | Incorrect | 96 ms | 10496 KB | Output isn't correct |
73 | Incorrect | 116 ms | 10496 KB | Output isn't correct |
74 | Incorrect | 76 ms | 10496 KB | Output isn't correct |
75 | Incorrect | 116 ms | 10496 KB | Output isn't correct |
76 | Incorrect | 109 ms | 10496 KB | Output isn't correct |
77 | Incorrect | 53 ms | 10496 KB | Output isn't correct |
78 | Incorrect | 129 ms | 10496 KB | Output isn't correct |
79 | Incorrect | 153 ms | 10496 KB | Output isn't correct |
80 | Incorrect | 103 ms | 10496 KB | Output isn't correct |
81 | Incorrect | 33 ms | 10496 KB | Output isn't correct |
82 | Incorrect | 103 ms | 10496 KB | Output isn't correct |
83 | Incorrect | 116 ms | 10496 KB | Output isn't correct |
84 | Incorrect | 109 ms | 10496 KB | Output isn't correct |
85 | Incorrect | 136 ms | 10496 KB | Output isn't correct |
86 | Incorrect | 139 ms | 10496 KB | Output isn't correct |
87 | Incorrect | 106 ms | 10496 KB | Output isn't correct |
88 | Incorrect | 23 ms | 10496 KB | Output isn't correct |
89 | Incorrect | 69 ms | 10496 KB | Output isn't correct |
90 | Incorrect | 43 ms | 10496 KB | Output isn't correct |
91 | Incorrect | 3 ms | 10496 KB | Output isn't correct |
92 | Incorrect | 49 ms | 10496 KB | Output isn't correct |