Submission #598925

#TimeUsernameProblemLanguageResultExecution timeMemory
598925JomnoiHedgehog Daniyar and Algorithms (IZhO19_sortbooks)C++17
0 / 100
3061 ms40756 KiB
#include <bits/stdc++.h> using namespace std; const int MAX_N = 1e6 + 5; int w[MAX_N]; int main() { cin.tie(nullptr)->sync_with_stdio(false); int N, M; cin >> N >> M; for(int i = 1; i <= N; i++) { cin >> w[i]; } while(M--) { int l, r, k; cin >> l >> r >> k; multiset <int> s; for(int i = l; i <= r; i++) { s.insert(w[i]); } int ma = 0; for(int i = l; i < r; i++) { s.erase(s.lower_bound(w[i])); ma = max(ma, w[i] + *prev(s.lower_bound(w[i]))); } cout << (ma <= 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...