#include<bits/stdc++.h>
using namespace std;
const long long N = 1e6 + 10;
int main () {
int n, m;
cin >> n >> m;
long long arr[n];
for(int i = 0;i<n;i++)cin>>arr[i];
while(m--) {
int l, r, m;
cin >> l >> r >> m;
long long MAX = arr[l-1],ans = 0;
for(int i = l;i<r;i++) {
MAX = max(arr[i],MAX);
if(arr[i] < MAX)
ans = max(ans, MAX+arr[i]);
}
cout << (ans <= m) << endl;
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
2 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
2 ms |
204 KB |
Output is correct |
7 |
Correct |
2 ms |
300 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 |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
2 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
2 ms |
204 KB |
Output is correct |
7 |
Correct |
2 ms |
300 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 |
12 ms |
332 KB |
Output is correct |
12 |
Correct |
14 ms |
428 KB |
Output is correct |
13 |
Correct |
14 ms |
332 KB |
Output is correct |
14 |
Correct |
22 ms |
484 KB |
Output is correct |
15 |
Correct |
20 ms |
488 KB |
Output is correct |
16 |
Correct |
22 ms |
436 KB |
Output is correct |
17 |
Correct |
18 ms |
332 KB |
Output is correct |
18 |
Correct |
25 ms |
416 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3059 ms |
8116 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2793 ms |
1220 KB |
Output is correct |
2 |
Execution timed out |
3061 ms |
1544 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
2 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
2 ms |
204 KB |
Output is correct |
7 |
Correct |
2 ms |
300 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 |
12 ms |
332 KB |
Output is correct |
12 |
Correct |
14 ms |
428 KB |
Output is correct |
13 |
Correct |
14 ms |
332 KB |
Output is correct |
14 |
Correct |
22 ms |
484 KB |
Output is correct |
15 |
Correct |
20 ms |
488 KB |
Output is correct |
16 |
Correct |
22 ms |
436 KB |
Output is correct |
17 |
Correct |
18 ms |
332 KB |
Output is correct |
18 |
Correct |
25 ms |
416 KB |
Output is correct |
19 |
Execution timed out |
3066 ms |
2632 KB |
Time limit exceeded |
20 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
2 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
2 ms |
204 KB |
Output is correct |
7 |
Correct |
2 ms |
300 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 |
12 ms |
332 KB |
Output is correct |
12 |
Correct |
14 ms |
428 KB |
Output is correct |
13 |
Correct |
14 ms |
332 KB |
Output is correct |
14 |
Correct |
22 ms |
484 KB |
Output is correct |
15 |
Correct |
20 ms |
488 KB |
Output is correct |
16 |
Correct |
22 ms |
436 KB |
Output is correct |
17 |
Correct |
18 ms |
332 KB |
Output is correct |
18 |
Correct |
25 ms |
416 KB |
Output is correct |
19 |
Execution timed out |
3059 ms |
8116 KB |
Time limit exceeded |
20 |
Halted |
0 ms |
0 KB |
- |