# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
224158 | 2020-04-17T08:58:11 Z | SomeoneUnknown | Fire (JOI20_ho_t5) | C++14 | 163 ms | 7980 KB |
#include <bits/stdc++.h> using namespace std; typedef pair<int, int> ii; ii mii(int a, int b){ return make_pair(a,b); } int main(){ int n, q; scanf("%d %d", &n, &q); bool constt = true; int str[n]; for(int i = 0; i < n; i++){ scanf("%d", &str[i]); } int ts[q]; int ss[q]; int es[q]; for(int i = 0; i < q; i++){ scanf("%d %d %d", &ts[i], &ss[i], &es[i]); if(i > 0 && ts[i] != ts[i-1]) constt = false; } if(constt){ deque<ii> dq; long long spfs[n+1]; spfs[0] = 0; for(int i = 0; i < n; i++){ if(i > ts[0]){ while(dq.front().second < i-ts[0]) dq.pop_front(); } while(!dq.empty() && dq.back().first < str[i]){ dq.pop_back(); } dq.push_back(mii(str[i], i)); spfs[i+1] = spfs[i] + dq.front().first; } for(int i = 0; i < q; i++){ printf("%lld\n", spfs[es[i]]-spfs[ss[i]-1]); } } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Incorrect | 5 ms | 256 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Correct | 147 ms | 7720 KB | Output is correct |
3 | Correct | 153 ms | 7800 KB | Output is correct |
4 | Correct | 147 ms | 7928 KB | Output is correct |
5 | Correct | 154 ms | 7832 KB | Output is correct |
6 | Correct | 145 ms | 7800 KB | Output is correct |
7 | Correct | 147 ms | 7980 KB | Output is correct |
8 | Correct | 145 ms | 7804 KB | Output is correct |
9 | Correct | 163 ms | 7928 KB | Output is correct |
10 | Correct | 154 ms | 7800 KB | Output is correct |
11 | Correct | 148 ms | 7928 KB | Output is correct |
12 | Correct | 149 ms | 7672 KB | Output is correct |
13 | Correct | 153 ms | 7832 KB | Output is correct |
14 | Correct | 145 ms | 7676 KB | Output is correct |
15 | Correct | 142 ms | 7800 KB | Output is correct |
16 | Correct | 141 ms | 7928 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Incorrect | 127 ms | 3424 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 106 ms | 3296 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Incorrect | 5 ms | 256 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |