Submission #992972

#TimeUsernameProblemLanguageResultExecution timeMemory
992972serkanrashidHedgehog Daniyar and Algorithms (IZhO19_sortbooks)C++14
17 / 100
3046 ms9124 KiB
#include <bits/stdc++.h> #define endl "\n" using namespace std; const int maxn = 1e6+5; int n,m; int w[maxn]; bool check(int l, int r, int k) { int maxch = 0; int razmqna = 0; for(int i = l; i <= r; i++) { if(maxch>w[i]) razmqna = max(razmqna,maxch+w[i]); maxch = max(maxch,w[i]); } return k >= razmqna; } void read() { cin >> n >> m; for(int i = 1; i <= n; i++) cin >> w[i]; int l,r,k; for(int i = 1; i <= m; i++) { cin >> l >> r >> k; if(check(l,r,k)) cout << 1 << endl; else cout << 0 << endl; } } int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); read(); 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...