#include <iostream>
using namespace std;
using ll = long long;
const ll INF = 1e9 + 177013;
const int MAXN = 1e6 + 123;
int w[MAXN];
int get_max(int l, int r) {
int mx = -INF;
int ans = 0;
for (int i = l; i < r; ++i) {
if (mx > w[i])
ans = max(ans, mx + w[i]);
else
mx = w[i];
}
return ans;
}
signed main() {
int n, m;
cin >> n >> m;
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;
if (get_max(l, r) > k) {
cout << 0 << '\n';
} else {
cout << 1 << '\n';
}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
2 ms |
316 KB |
Output is correct |
7 |
Correct |
2 ms |
212 KB |
Output is correct |
8 |
Correct |
2 ms |
212 KB |
Output is correct |
9 |
Correct |
2 ms |
212 KB |
Output is correct |
10 |
Correct |
2 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
2 ms |
316 KB |
Output is correct |
7 |
Correct |
2 ms |
212 KB |
Output is correct |
8 |
Correct |
2 ms |
212 KB |
Output is correct |
9 |
Correct |
2 ms |
212 KB |
Output is correct |
10 |
Correct |
2 ms |
212 KB |
Output is correct |
11 |
Correct |
13 ms |
340 KB |
Output is correct |
12 |
Correct |
13 ms |
340 KB |
Output is correct |
13 |
Correct |
15 ms |
316 KB |
Output is correct |
14 |
Correct |
24 ms |
468 KB |
Output is correct |
15 |
Correct |
24 ms |
484 KB |
Output is correct |
16 |
Correct |
25 ms |
340 KB |
Output is correct |
17 |
Correct |
19 ms |
340 KB |
Output is correct |
18 |
Correct |
26 ms |
404 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3021 ms |
4440 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2895 ms |
1724 KB |
Output is correct |
2 |
Execution timed out |
3055 ms |
1984 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
2 ms |
316 KB |
Output is correct |
7 |
Correct |
2 ms |
212 KB |
Output is correct |
8 |
Correct |
2 ms |
212 KB |
Output is correct |
9 |
Correct |
2 ms |
212 KB |
Output is correct |
10 |
Correct |
2 ms |
212 KB |
Output is correct |
11 |
Correct |
13 ms |
340 KB |
Output is correct |
12 |
Correct |
13 ms |
340 KB |
Output is correct |
13 |
Correct |
15 ms |
316 KB |
Output is correct |
14 |
Correct |
24 ms |
468 KB |
Output is correct |
15 |
Correct |
24 ms |
484 KB |
Output is correct |
16 |
Correct |
25 ms |
340 KB |
Output is correct |
17 |
Correct |
19 ms |
340 KB |
Output is correct |
18 |
Correct |
26 ms |
404 KB |
Output is correct |
19 |
Execution timed out |
3042 ms |
4628 KB |
Time limit exceeded |
20 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
2 ms |
316 KB |
Output is correct |
7 |
Correct |
2 ms |
212 KB |
Output is correct |
8 |
Correct |
2 ms |
212 KB |
Output is correct |
9 |
Correct |
2 ms |
212 KB |
Output is correct |
10 |
Correct |
2 ms |
212 KB |
Output is correct |
11 |
Correct |
13 ms |
340 KB |
Output is correct |
12 |
Correct |
13 ms |
340 KB |
Output is correct |
13 |
Correct |
15 ms |
316 KB |
Output is correct |
14 |
Correct |
24 ms |
468 KB |
Output is correct |
15 |
Correct |
24 ms |
484 KB |
Output is correct |
16 |
Correct |
25 ms |
340 KB |
Output is correct |
17 |
Correct |
19 ms |
340 KB |
Output is correct |
18 |
Correct |
26 ms |
404 KB |
Output is correct |
19 |
Execution timed out |
3021 ms |
4440 KB |
Time limit exceeded |
20 |
Halted |
0 ms |
0 KB |
- |