# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
569650 | 2022-05-27T15:16:46 Z | SSRS | Hedgehog Daniyar and Algorithms (IZhO19_sortbooks) | C++14 | 0 ms | 0 KB |
#include <bits/stdc++.h> using namespace std; int main(){ int N, M; cin >> N >> M; vector<int> w(N); for (int i = 0; i < N; i++){ cin >> w[i]; } for (int i = 0; i < M; i++){ int l, r, k; cin >> l >> r >> k; l--; int mx = 0; for (int x = j; x < r; x++){ for (int y = j + 1; y < r; y++){ if (w[x] > w[y]){ mx = max(mx, w[x] + w[y]); } } } if (mx <= k){ cout << 1 << endl; } else { cout << 0 << endl; } } }