#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, --r;
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 |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
2 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
292 KB |
Output is correct |
5 |
Correct |
1 ms |
260 KB |
Output is correct |
6 |
Correct |
2 ms |
204 KB |
Output is correct |
7 |
Correct |
2 ms |
204 KB |
Output is correct |
8 |
Correct |
2 ms |
204 KB |
Output is correct |
9 |
Correct |
2 ms |
204 KB |
Output is correct |
10 |
Correct |
2 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
2 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
292 KB |
Output is correct |
5 |
Correct |
1 ms |
260 KB |
Output is correct |
6 |
Correct |
2 ms |
204 KB |
Output is correct |
7 |
Correct |
2 ms |
204 KB |
Output is correct |
8 |
Correct |
2 ms |
204 KB |
Output is correct |
9 |
Correct |
2 ms |
204 KB |
Output is correct |
10 |
Correct |
2 ms |
204 KB |
Output is correct |
11 |
Correct |
10 ms |
332 KB |
Output is correct |
12 |
Correct |
14 ms |
332 KB |
Output is correct |
13 |
Correct |
16 ms |
332 KB |
Output is correct |
14 |
Correct |
25 ms |
464 KB |
Output is correct |
15 |
Correct |
27 ms |
468 KB |
Output is correct |
16 |
Correct |
35 ms |
416 KB |
Output is correct |
17 |
Correct |
29 ms |
332 KB |
Output is correct |
18 |
Correct |
32 ms |
396 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3055 ms |
4340 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3056 ms |
952 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
2 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
292 KB |
Output is correct |
5 |
Correct |
1 ms |
260 KB |
Output is correct |
6 |
Correct |
2 ms |
204 KB |
Output is correct |
7 |
Correct |
2 ms |
204 KB |
Output is correct |
8 |
Correct |
2 ms |
204 KB |
Output is correct |
9 |
Correct |
2 ms |
204 KB |
Output is correct |
10 |
Correct |
2 ms |
204 KB |
Output is correct |
11 |
Correct |
10 ms |
332 KB |
Output is correct |
12 |
Correct |
14 ms |
332 KB |
Output is correct |
13 |
Correct |
16 ms |
332 KB |
Output is correct |
14 |
Correct |
25 ms |
464 KB |
Output is correct |
15 |
Correct |
27 ms |
468 KB |
Output is correct |
16 |
Correct |
35 ms |
416 KB |
Output is correct |
17 |
Correct |
29 ms |
332 KB |
Output is correct |
18 |
Correct |
32 ms |
396 KB |
Output is correct |
19 |
Execution timed out |
3041 ms |
4552 KB |
Time limit exceeded |
20 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
2 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
292 KB |
Output is correct |
5 |
Correct |
1 ms |
260 KB |
Output is correct |
6 |
Correct |
2 ms |
204 KB |
Output is correct |
7 |
Correct |
2 ms |
204 KB |
Output is correct |
8 |
Correct |
2 ms |
204 KB |
Output is correct |
9 |
Correct |
2 ms |
204 KB |
Output is correct |
10 |
Correct |
2 ms |
204 KB |
Output is correct |
11 |
Correct |
10 ms |
332 KB |
Output is correct |
12 |
Correct |
14 ms |
332 KB |
Output is correct |
13 |
Correct |
16 ms |
332 KB |
Output is correct |
14 |
Correct |
25 ms |
464 KB |
Output is correct |
15 |
Correct |
27 ms |
468 KB |
Output is correct |
16 |
Correct |
35 ms |
416 KB |
Output is correct |
17 |
Correct |
29 ms |
332 KB |
Output is correct |
18 |
Correct |
32 ms |
396 KB |
Output is correct |
19 |
Execution timed out |
3055 ms |
4340 KB |
Time limit exceeded |
20 |
Halted |
0 ms |
0 KB |
- |