# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
242236 | 2020-06-27T07:12:10 Z | cheeheng | Triple Jump (JOI19_jumps) | C++17 | 1622 ms | 203372 KB |
#include <bits/stdc++.h> using namespace std; int A[500005]; int B[5005][5005]; int C[500005]; int D[5005][5005]; // {5,2,1,5,3} // {0,1,2,3,4} int main(){ int N; scanf("%d", &N); for(int i = 1; i <= N; i ++){ scanf("%d", &A[i]); } for(int i = 1; i <= N; i ++){ int max1 = 0; for(int j = i+2; j <= N; j ++){ if((j-i)&1){} else{ max1 = max(A[(j+i)>>1], max1); } B[i][j-2] = A[i] + A[j] + max1; } } /*for(int i = 1; i <= N-2; i ++){ for(int j = 1; j <= N-2; j ++){ printf("%3d ", B[i][j]); } printf("\n"); }*/ for(int j = N-2; j >= 1; j --){ for(int i = 1; i <= N-2; i ++){ C[i] = max(C[i], B[j][i]); //printf("C[%d]=%d\n", i, C[i]); } int max1 = 0; for(int i = j; i <= N-2; i ++){ max1 = max(max1, C[i]); D[j][i] = max1; //printf("D[%d][%d]=%d\n", j, i, max1); } } int Q; scanf("%d", &Q); while(Q --){ int l, r; scanf("%d%d", &l, &r); printf("%d\n", D[l][r-2]); } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Correct | 5 ms | 1152 KB | Output is correct |
3 | Correct | 6 ms | 1152 KB | Output is correct |
4 | Correct | 5 ms | 1152 KB | Output is correct |
5 | Correct | 5 ms | 1152 KB | Output is correct |
6 | Correct | 5 ms | 1152 KB | Output is correct |
7 | Correct | 5 ms | 1152 KB | Output is correct |
8 | Correct | 5 ms | 1152 KB | Output is correct |
9 | Correct | 5 ms | 1152 KB | Output is correct |
10 | Correct | 5 ms | 1152 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Correct | 5 ms | 1152 KB | Output is correct |
3 | Correct | 6 ms | 1152 KB | Output is correct |
4 | Correct | 5 ms | 1152 KB | Output is correct |
5 | Correct | 5 ms | 1152 KB | Output is correct |
6 | Correct | 5 ms | 1152 KB | Output is correct |
7 | Correct | 5 ms | 1152 KB | Output is correct |
8 | Correct | 5 ms | 1152 KB | Output is correct |
9 | Correct | 5 ms | 1152 KB | Output is correct |
10 | Correct | 5 ms | 1152 KB | Output is correct |
11 | Correct | 368 ms | 139568 KB | Output is correct |
12 | Correct | 370 ms | 139384 KB | Output is correct |
13 | Correct | 389 ms | 139640 KB | Output is correct |
14 | Correct | 388 ms | 139512 KB | Output is correct |
15 | Correct | 364 ms | 139512 KB | Output is correct |
16 | Correct | 389 ms | 138872 KB | Output is correct |
17 | Correct | 373 ms | 138872 KB | Output is correct |
18 | Correct | 394 ms | 138872 KB | Output is correct |
19 | Correct | 374 ms | 139512 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1622 ms | 203372 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Correct | 5 ms | 1152 KB | Output is correct |
3 | Correct | 6 ms | 1152 KB | Output is correct |
4 | Correct | 5 ms | 1152 KB | Output is correct |
5 | Correct | 5 ms | 1152 KB | Output is correct |
6 | Correct | 5 ms | 1152 KB | Output is correct |
7 | Correct | 5 ms | 1152 KB | Output is correct |
8 | Correct | 5 ms | 1152 KB | Output is correct |
9 | Correct | 5 ms | 1152 KB | Output is correct |
10 | Correct | 5 ms | 1152 KB | Output is correct |
11 | Correct | 368 ms | 139568 KB | Output is correct |
12 | Correct | 370 ms | 139384 KB | Output is correct |
13 | Correct | 389 ms | 139640 KB | Output is correct |
14 | Correct | 388 ms | 139512 KB | Output is correct |
15 | Correct | 364 ms | 139512 KB | Output is correct |
16 | Correct | 389 ms | 138872 KB | Output is correct |
17 | Correct | 373 ms | 138872 KB | Output is correct |
18 | Correct | 394 ms | 138872 KB | Output is correct |
19 | Correct | 374 ms | 139512 KB | Output is correct |
20 | Runtime error | 1622 ms | 203372 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
21 | Halted | 0 ms | 0 KB | - |