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() {
cin.tie(nullptr)->sync_with_stdio(false);
int N, M;
cin >> N >> M;
vector<int> W(N);
for (int &value : W) {
cin >> value;
}
while (M--) {
int L, R, K;
cin >> L >> R >> K;
L--, R--;
int current = 0;
bool good = true;
for (int i = L; i <= R; i++) {
current = max(current, W[i]);
if (W[i] < current) {
if (W[i] + current > K) {
good = false;
}
}
}
cout << int(good) << "\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... |