Submission #651194

#TimeUsernameProblemLanguageResultExecution timeMemory
651194owoovoHedgehog Daniyar and Algorithms (IZhO19_sortbooks)C++14
17 / 100
3087 ms53384 KiB
#include<bits/stdc++.h> using namespace std; int main(){ cin.tie(0); ios::sync_with_stdio(0); int n,m; cin>>n>>m; int w[1000010]; for(int i=0;i<n;i++){ cin>>w[i]; } for(int i=0;i<m;i++){ int l,r,k,isok=1; cin>>l>>r>>k; r--; l--; set<int> s; for(int j=r;j>=l;j--){ if(!s.empty()){ set<int>::iterator q=s.lower_bound(w[j]); if(q!=s.begin()){ q--; if(w[j]+*q>k){ cout<<"0\n"; isok=0; break; } } } s.insert(w[j]); } if(isok){ cout<<"1\n"; } } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...