This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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;
int mx = w[l], ans = 0;
for (int j = l + 1; j <= r; ++j) {
if (mx > w[j])
ans = max(ans, mx + w[j]);
mx = max(mx, w[j]);
}
cout << (ans <= k) << '\n';
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |