Submission #172637

#TimeUsernameProblemLanguageResultExecution timeMemory
172637LinusTorvaldsFanHedgehog Daniyar and Algorithms (IZhO19_sortbooks)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #pragma GCC optimize("OFast") #pragma GCC target("sse,sse2,sse3,ssse3,sse4") using namespace std; const int maxn=1000000+7; int w[maxn]; const int K=1000; int block_answer[maxn/K+1]; int block_max[maxn/K+1]; int get(int l, int r, int x) { int ans=-1; for(l+=Q,r+=Q;l<r;l>>=1,r>>=1){ if(l&1) { auto t=lower_bound(tree[l].begin(),tree[l].end(),x); if(t!=tree[l].begin()){ t--; ans=max(ans,*t); } l++; } if(r&1) { r--; auto t=lower_bound(tree[r].begin(),tree[r].end(),x); if(t!=tree[r].begin()){ t--; ans=max(ans,*t); } } } return ans; } int main() { ios_base::sync_with_stdio(0); cin.tie(0); // freopen("input.txt","r",stdin); int n,m; cin>>n>>m; for(int i=0;i<n;i++)cin>>w[i]; for(int i=0;i+K-1<n;i+=K){ int block=i/K; block_answer[block]=-1; for(int l=i;l<i+K;l++){ for(int r=l+1;r<i+K;r++){ if(w[l]>w[r]){ block_answer[block]=max(block_answer[block],w[l]+w[r]); } } } for(int l=i;l<i+K;l++){ block_max[block]=max(block_max[block],w[l]); } //cout<<block_answer[block]<<" "; //cout<<block_max[block]<<endl; } // build(n); for(;m;m--){ int l,r,k; cin>>l>>r>>k; l--; r--; int ans=-1; int max_left=-1; for(;l%K!=0 && l <= r;l++){ //int q=get(l+1,r+1,w[l]); //cout<<q<<endl; //if(q!=-1) ans=max(ans,w[l]+q); if(w[l]<max_left){ ans=2e9+7; } max_left=max(w[l],max_left); } for(;l+K-1<=r;l+=K){ int block=l/K; ans=max(ans,block_answer[block]); // int q=get(l+K,r+1,block_max[block]); // cout<<":"<<q<<"\n"; // if(q!=-1) ans=max(ans,block_max[block]+q); if(block_max[block]<max_left){ ans=2e9+7; } max_left=max(max_left,block_max[block]); } for(;l<=r;l++){ // int q=get(l+1,r+1,w[l]); // cout<<q<<endl; // if(q!=-1) ans=max(ans,w[l]+q); if(w[l]<max_left){ ans=2e9+7; } max_left=max(w[l],max_left); } // cout<<ans<<endl; if(ans<=k){ cout<<1<<'\n'; } else { cout<<0<<'\n'; } } return 0; }

Compilation message (stderr)

sortbooks.cpp:2:29: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
 #pragma GCC optimize("OFast")
                             ^
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
 #pragma GCC target("sse,sse2,sse3,ssse3,sse4")
                                              ^
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
sortbooks.cpp:3:46: error: argument to '-O' should