# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
200642 | 2020-02-07T19:11:39 Z | tincamatei | Triple Jump (JOI19_jumps) | C++14 | 301 ms | 136312 KB |
#include <bits/stdc++.h> using namespace std; const int MAX_N = 5000; int v[1+MAX_N], maxRange[1+MAX_N][1+MAX_N], dp[1+MAX_N][1+MAX_N]; int main() { int N, Q; scanf("%d", &N); for(int i = 1; i <= N; ++i) { scanf("%d", &v[i]); for(int j = i; j >= 1; --j) maxRange[i][j] = max(maxRange[j + 1][i], v[j]); } for(int d = 3; d <= N; ++d) for(int i = 1; i + d - 1 <= N; ++i) { int j = i + d - 1; dp[i][j] = max(v[i] + v[j] + maxRange[i + 1][(i + j) / 2], max(dp[i + 1][j], dp[i][j - 1])); } scanf("%d", &Q); for(int i = 0; i < Q; ++i) { int l, r; scanf("%d%d", &l, &r); printf("%d\n", dp[l][r]); } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 376 KB | Output is correct |
2 | Incorrect | 5 ms | 1144 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 376 KB | Output is correct |
2 | Incorrect | 5 ms | 1144 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 301 ms | 136312 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 | 376 KB | Output is correct |
2 | Incorrect | 5 ms | 1144 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |