# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
515448 | 2022-01-19T07:42:33 Z | 79brue | Triple Jump (JOI19_jumps) | C++14 | 4000 ms | 964 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; int n, q; int arr[500002]; int DP[5002][5002]; int DPmax[5002][5002]; int main(){ scanf("%d", &n); for(int i=1; i<=n; i++) scanf("%d", &arr[i]); scanf("%d", &q); while(q--){ int l, r; scanf("%d %d", &l, &r); int ans = 0; for(int b=l+1; b<r; b++){ int aMax = 0, aVal = -1; for(int a=max(l, 2*b-r); a<b; a++){ if(aVal <= arr[a]) aMax = a, aVal = arr[a]; } for(int c=b+1; c<=r; c++) if(b-aMax <= c-b) ans = max(ans, arr[aMax] + arr[b] + arr[c]); int cMax = 0, cVal = -1; for(int c=b+1; c<=r; c++){ if(cVal <= arr[c]) cMax = c, cVal = arr[c]; } for(int a=l; a<b; a++) if(b-a <= cMax-b) ans = max(ans, arr[a] + arr[b] + arr[cMax]); } printf("%d\n", ans); } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 204 KB | Output is correct |
4 | Correct | 1 ms | 204 KB | Output is correct |
5 | Correct | 1 ms | 204 KB | Output is correct |
6 | Correct | 1 ms | 204 KB | Output is correct |
7 | Correct | 1 ms | 204 KB | Output is correct |
8 | Correct | 1 ms | 204 KB | Output is correct |
9 | Correct | 1 ms | 204 KB | Output is correct |
10 | Incorrect | 1 ms | 204 KB | Output isn't correct |
11 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 204 KB | Output is correct |
4 | Correct | 1 ms | 204 KB | Output is correct |
5 | Correct | 1 ms | 204 KB | Output is correct |
6 | Correct | 1 ms | 204 KB | Output is correct |
7 | Correct | 1 ms | 204 KB | Output is correct |
8 | Correct | 1 ms | 204 KB | Output is correct |
9 | Correct | 1 ms | 204 KB | Output is correct |
10 | Incorrect | 1 ms | 204 KB | Output isn't correct |
11 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 4042 ms | 964 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 204 KB | Output is correct |
4 | Correct | 1 ms | 204 KB | Output is correct |
5 | Correct | 1 ms | 204 KB | Output is correct |
6 | Correct | 1 ms | 204 KB | Output is correct |
7 | Correct | 1 ms | 204 KB | Output is correct |
8 | Correct | 1 ms | 204 KB | Output is correct |
9 | Correct | 1 ms | 204 KB | Output is correct |
10 | Incorrect | 1 ms | 204 KB | Output isn't correct |
11 | Halted | 0 ms | 0 KB | - |