# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
242345 | 2020-06-27T09:06:31 Z | SomeoneUnknown | Triple Jump (JOI19_jumps) | C++14 | 4000 ms | 98808 KB |
#include <bits/stdc++.h> using namespace std; struct nodei{ int lo, hi, mid, val; int lazyclr; nodei *lft, *rght; nodei(int l, int h){ lo = l; hi = h; mid = (l+h)/2; val = 0; lazyclr = 0; if(h<l) exit(-1); if(l<h){ lft = new nodei(l, mid); rght = new nodei(mid+1, h); } } void propogate(){ //if(!lazyclr) return; //val = 0; if(lo<hi){ lft->lazyclr += lazyclr; rght->lazyclr += lazyclr; } val += lazyclr; lazyclr = 0; } int queryf(){ propogate(); if(lo == hi) return lo; lft->propogate(); rght->propogate(); if(lft->val < rght->val){ return rght->queryf(); }else{ return lft->queryf(); } } int queryr(int l, int h){ propogate(); if(l <= lo && h >= hi) return val; if(l > mid) return rght->queryr(l, h); if(h <= mid) return lft->queryr(l, h); return max(lft->queryr(l, h), rght->queryr(l, h)); } void update(int l, int h, int v){ propogate(); if(l <= lo && h >= hi){ lazyclr += v; return; } if(h > mid) rght->update(l, h, v); if(l <= mid) lft->update(l, h, v); lft->propogate(); rght->propogate(); val = max(lft->val, rght->val); } //write query! } *rootv, *rootc; int main(){ int n; scanf("%d", &n); rootv = new nodei(0, n-1); int firm[n]; for(int i = 0; i < n; ++i){ scanf("%d", &firm[i]); rootv->update(i, i, firm[i]); } int best[n][n]; for(int i = 0; i < n; i++){ for(int j = 0; j < n; j++){ best[i][j] = 0; if(j <= i+1){ continue; } int base = firm[i]+firm[j]; best[i][j] = rootv->queryr(i+1, (i+j)/2)+base; } } int q; scanf("%d", &q); for(int i = 0; i < q; i++){ int a, c; scanf("%d %d", &a, &c); int cbest = 0; for(int j = a; j < c; j++){ for(int k = j+2; k <= c; k++){ cbest = max(cbest, best[j-1][k-1]); } } printf("%d\n", cbest); } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Correct | 5 ms | 384 KB | Output is correct |
3 | Correct | 5 ms | 384 KB | Output is correct |
4 | Correct | 5 ms | 384 KB | Output is correct |
5 | Correct | 5 ms | 384 KB | Output is correct |
6 | Correct | 5 ms | 384 KB | Output is correct |
7 | Correct | 5 ms | 384 KB | Output is correct |
8 | Correct | 5 ms | 384 KB | Output is correct |
9 | Correct | 5 ms | 384 KB | Output is correct |
10 | Correct | 5 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Correct | 5 ms | 384 KB | Output is correct |
3 | Correct | 5 ms | 384 KB | Output is correct |
4 | Correct | 5 ms | 384 KB | Output is correct |
5 | Correct | 5 ms | 384 KB | Output is correct |
6 | Correct | 5 ms | 384 KB | Output is correct |
7 | Correct | 5 ms | 384 KB | Output is correct |
8 | Correct | 5 ms | 384 KB | Output is correct |
9 | Correct | 5 ms | 384 KB | Output is correct |
10 | Correct | 5 ms | 384 KB | Output is correct |
11 | Execution timed out | 4080 ms | 98808 KB | Time limit exceeded |
12 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 177 ms | 40056 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 | 384 KB | Output is correct |
3 | Correct | 5 ms | 384 KB | Output is correct |
4 | Correct | 5 ms | 384 KB | Output is correct |
5 | Correct | 5 ms | 384 KB | Output is correct |
6 | Correct | 5 ms | 384 KB | Output is correct |
7 | Correct | 5 ms | 384 KB | Output is correct |
8 | Correct | 5 ms | 384 KB | Output is correct |
9 | Correct | 5 ms | 384 KB | Output is correct |
10 | Correct | 5 ms | 384 KB | Output is correct |
11 | Execution timed out | 4080 ms | 98808 KB | Time limit exceeded |
12 | Halted | 0 ms | 0 KB | - |