# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1115060 |
2024-11-19T23:30:19 Z |
staszic_ojuz |
Fire (JOI20_ho_t5) |
C++17 |
|
8 ms |
3664 KB |
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int tree[400007];
void Treeify(int trsize){
for (int i=trsize-1;i>0;i--) tree[i]=max(tree[2*i], tree[2*i+1]);
}
int Get(int v, int l, int r, int vl, int vr){
if (vl>r||vr<l) return 0;
if (vl>=l&&vr<=r){
return tree[v];
}
if (tree[vr]==5){
v=v;
}
int mid=(vl+vr)/2;
int lson=Get(v*2, l, r, vl, mid);
int rson=Get(v*2+1, l, r, mid+1, vr);
return max(lson, rson);
}
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
for (int i=0;i<400007;i++) tree[i]=0;
int n, q;
cin>>n>>q;
int trsize=1;
while (trsize<n) trsize<<=1;
for (int i=0;i<n;i++){
cin>>tree[trsize+i];
}
Treeify(trsize);
for (int i=1;i<=trsize*2+1;i++) cout<<tree[i]<<" ";
cout<<'\n';
for (int qe=0;qe<q;qe++){
int t, l, r;
cin>>t>>l>>r;
l=max(0, l-t);
cout<<Get(1, trsize+l, trsize+r, trsize, trsize*2+1)<<'\n';
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
1872 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
1872 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
1872 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
8 ms |
3664 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
1872 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |