Submission #887291

#TimeUsernameProblemLanguageResultExecution timeMemory
887291Hovhannes1234Hedgehog Daniyar and Algorithms (IZhO19_sortbooks)C++17
13 / 100
2159 ms7312 KiB
#include <bits/stdc++.h> using namespace std; const int N=1e6+10; int a[N]; bool sorted[N]; int main() { int n,m; cin>>n>>m; sorted[0]=true; for(int i=1; i<=n; i++) { cin>>a[i]; if(sorted[i-1] && a[i] >= a[i-1])sorted[i]=true; } for(int i=1; i<=m; i++){ int l,r,k; cin>>l>>r>>k; bool ans=true; if(sorted[r]){ cout<<ans<<endl; continue; } for(int i=l; i<r; i++){ if(a[i] > a[i+1]){ ans=false; break; } } cout<<ans<<endl; } }
#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...