Submission #334371

#TimeUsernameProblemLanguageResultExecution timeMemory
334371limabeansHedgehog Daniyar and Algorithms (IZhO19_sortbooks)C++17
17 / 100
3072 ms8504 KiB
#include <bits/stdc++.h> using namespace std; template<typename T> void out(T x) { cout << x << endl; exit(0); } #define watch(x) cout << (#x) << " is " << (x) << endl using ll = long long; const int maxn = 1e6 + 5; int n,q; int a[maxn]; bool solve(int l, int r, int k) { int hi=-1; for (int i=l; i<=r; i++) { if (i>l && hi>a[i] && hi+a[i]>k) return false; hi=max(hi,a[i]); } return true; } int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin>>n>>q; for (int i=1; i<=n; i++) { cin>>a[i]; } while (q--) { int l,r,k; cin>>l>>r>>k; cout<<solve(l,r,k)<<"\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...