Submission #876634

#TimeUsernameProblemLanguageResultExecution timeMemory
876634IrateHedgehog Daniyar and Algorithms (IZhO19_sortbooks)C++14
17 / 100
3057 ms14468 KiB
#include<bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int n, q; cin >> n >> q; vector<int>v(n); for(int i = 0;i < n;++i)cin >> v[i]; while(q--){ int l, r, k; cin >> l >> r >> k; l--; r--; int mx = v[l], res = 0; for(int i = l + 1;i <= r;++i){ if(mx > v[i]){ res = max(res, mx + v[i]); } mx = max(mx, v[i]); } cout << (res <= k) << '\n'; } }
#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...