Submission #887289

#TimeUsernameProblemLanguageResultExecution timeMemory
887289Hovhannes1234Hedgehog Daniyar and Algorithms (IZhO19_sortbooks)C++17
0 / 100
2165 ms21096 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; 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...