Submission #334369

#TimeUsernameProblemLanguageResultExecution timeMemory
334369limabeansHedgehog Daniyar and Algorithms (IZhO19_sortbooks)C++17
8 / 100
3079 ms39300 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) { for (int i=l; i<=r; i++) { for (int j=i+1; j<=r; j++) { if (a[i]>a[j] && a[i]+a[j]>k) return false; } } 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...