# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
344096 | Nurlykhan | Hedgehog Daniyar and Algorithms (IZhO19_sortbooks) | C++17 | 3080 ms | 4528 KiB |
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;
const int N = (int)1e6 + 10;
int n, m;
int w[N];
int main() {
scanf("%d%d", &n, &m);
for (int i = 1; i <= n; i++) {
scanf("%d", &w[i]);
}
while (m--) {
int l, r, k;
scanf("%d%d%d", &l, &r, &k);
int mx = 0, mxx = w[l];
for (int i = l + 1; i <= r; i++) {
if (mxx <= w[i]) {
mxx = w[i];
} else {
mx = max(mx, mxx + w[i]);
}
}
if (k >= mx) {
printf("1\n");
} else {
printf("0\n");
}
}
return 0;
}
Compilation message (stderr)
# | 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... |