# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
222615 |
2020-04-13T12:37:57 Z |
astoria |
Fire (JOI20_ho_t5) |
C++14 |
|
527 ms |
24704 KB |
#include <bits/stdc++.h>
using namespace std;
#define int long long
int32_t main(){
multiset<int> ms;
int n,q;
cin>>n>>q;
int s[n+5];
for(int i=1; i<=n; i++) cin>>s[i];
int t[q],l[q],r[q];
for(int i=0; i<q; i++) cin>>t[i]>>l[i]>>r[i];
int val[n+5];
val[0] = 0;
for(int i=1; i<=t[0]; i++){
ms.insert(s[i]);
val[i] = *ms.rbegin();
}
for(int i=t[0]+1; i<=n; i++){
ms.insert(s[i]);
ms.erase(ms.find(s[i-t[0]]));
val[i] = *ms.rbegin();
}
int p[n+5]; p[0]=0;
for(int i=1; i<=n; i++) p[i]=p[i-1]+val[i];
for(int i=0; i<q; i++){
cout<<(p[r[i]]-p[l[i]-1])<<'\n';
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
256 KB |
Output is correct |
2 |
Incorrect |
5 ms |
384 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
256 KB |
Output is correct |
2 |
Correct |
527 ms |
21624 KB |
Output is correct |
3 |
Correct |
518 ms |
24704 KB |
Output is correct |
4 |
Incorrect |
519 ms |
18936 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
256 KB |
Output is correct |
2 |
Incorrect |
466 ms |
15352 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
356 ms |
21372 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
256 KB |
Output is correct |
2 |
Incorrect |
5 ms |
384 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |