# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
224126 |
2020-04-17T08:33:12 Z |
errorgorn |
Fire (JOI20_ho_t5) |
C++14 |
|
52 ms |
39160 KB |
#pragma GCC target ("avx2")
#pragma GCC optimization ("Ofast")
#pragma GCC optimization ("unroll-loops")
#pragma comment(linker, "/stack:200000000")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>
using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;
#define ll long long
#define ii pair<ll,ll>
#define iii pair<ii,ll>
#define endl '\n'
#define debug(x) cout << #x << " is " << x << endl;
#define rep(x,start,end) for(auto x=start-(start>end);x!=end-(start>end);x+=(start<end?1:-1))
#define all(x) x.begin(),x.end()
ll MAX(ll a){return a;}
ll MIN(ll a){return a;}
template<typename... Args>
ll MAX(ll a, Args... args) { return max(a,MAX(args...)); }
template<typename... Args>
ll MIN(ll a, Args... args) { return min(a,MIN(args...)); }
#define indexed_set tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>
struct node{
int s,e,m;
long long val=-1;
node *l,*r;
node(int _s,int _e){
s=_s,e=_e,m=(s+e)>>1;
if (s==e){
val=0; //here the value of all points is 0 at first
}
else{
l=new node(s,m);
r=new node(m+1,e);
val=l->val+r->val; //edit this for diff
}
}
long long query(int i,int j){
if (i==s && j==e) return val;
else if (j<=m) return l->query(i,j);
else if (m<i) return r->query(i,j);
else return max(l->query(i,m),r->query(m+1,j));
}
void update(int i, long long k){
if (s==e){
val=k;
}
else{
if (i<=m) l->update(i,k);
else r->update(i,k);
val=max(l->val,r->val);
}
}
}*root=new node(0,200005);
int n,q;
int arr[20005];
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin>>n>>q;
rep(x,1,n+1){
cin>>arr[x];
root->update(x,arr[x]);
}
int a,b,c;
while (q--){
cin>>a>>b>>c;
cout<<root->query(max(0,b-a+1),b);
}
}
Compilation message
ho_t5.cpp:2:0: warning: ignoring #pragma GCC optimization [-Wunknown-pragmas]
#pragma GCC optimization ("Ofast")
ho_t5.cpp:3:0: warning: ignoring #pragma GCC optimization [-Wunknown-pragmas]
#pragma GCC optimization ("unroll-loops")
ho_t5.cpp:4:0: warning: ignoring #pragma comment [-Wunknown-pragmas]
#pragma comment(linker, "/stack:200000000")
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
23 ms |
19072 KB |
Output is correct |
2 |
Incorrect |
21 ms |
19200 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
23 ms |
19072 KB |
Output is correct |
2 |
Runtime error |
52 ms |
39160 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
23 ms |
19072 KB |
Output is correct |
2 |
Runtime error |
52 ms |
39032 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
50 ms |
38776 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 |
23 ms |
19072 KB |
Output is correct |
2 |
Incorrect |
21 ms |
19200 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |