#include <bits/stdc++.h>
using namespace std;
int main(){
int n, m;
cin >> n >> m;
vector<long long> w(n + 1);
for(int i = 1; i <= n; i ++) cin >> w[i];
int l, r, k;
for(int i = 0; i < m; i ++){
cin >> l >> r >> k;
long long mx = w[l];
int check = 1;
for(int j = l; j <= r; j ++){
if(w[j] < mx && mx + w[j] > k){
check = 0;
break;
}
mx = max(mx,w[j]);
}
cout << check << '\n';
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 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 |
212 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 |
3 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 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 |
212 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 |
3 ms |
212 KB |
Output is correct |
11 |
Correct |
8 ms |
340 KB |
Output is correct |
12 |
Correct |
10 ms |
440 KB |
Output is correct |
13 |
Correct |
11 ms |
436 KB |
Output is correct |
14 |
Correct |
15 ms |
468 KB |
Output is correct |
15 |
Correct |
14 ms |
468 KB |
Output is correct |
16 |
Correct |
24 ms |
340 KB |
Output is correct |
17 |
Correct |
24 ms |
340 KB |
Output is correct |
18 |
Correct |
25 ms |
380 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2993 ms |
11008 KB |
Output is correct |
2 |
Correct |
2988 ms |
10148 KB |
Output is correct |
3 |
Correct |
2884 ms |
10116 KB |
Output is correct |
4 |
Correct |
2884 ms |
10388 KB |
Output is correct |
5 |
Execution timed out |
3085 ms |
9540 KB |
Time limit exceeded |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
829 ms |
3360 KB |
Output is correct |
2 |
Correct |
2140 ms |
3348 KB |
Output is correct |
3 |
Execution timed out |
3064 ms |
2904 KB |
Time limit exceeded |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 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 |
212 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 |
3 ms |
212 KB |
Output is correct |
11 |
Correct |
8 ms |
340 KB |
Output is correct |
12 |
Correct |
10 ms |
440 KB |
Output is correct |
13 |
Correct |
11 ms |
436 KB |
Output is correct |
14 |
Correct |
15 ms |
468 KB |
Output is correct |
15 |
Correct |
14 ms |
468 KB |
Output is correct |
16 |
Correct |
24 ms |
340 KB |
Output is correct |
17 |
Correct |
24 ms |
340 KB |
Output is correct |
18 |
Correct |
25 ms |
380 KB |
Output is correct |
19 |
Correct |
2555 ms |
8464 KB |
Output is correct |
20 |
Correct |
2488 ms |
8768 KB |
Output is correct |
21 |
Execution timed out |
3081 ms |
5844 KB |
Time limit exceeded |
22 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 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 |
212 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 |
3 ms |
212 KB |
Output is correct |
11 |
Correct |
8 ms |
340 KB |
Output is correct |
12 |
Correct |
10 ms |
440 KB |
Output is correct |
13 |
Correct |
11 ms |
436 KB |
Output is correct |
14 |
Correct |
15 ms |
468 KB |
Output is correct |
15 |
Correct |
14 ms |
468 KB |
Output is correct |
16 |
Correct |
24 ms |
340 KB |
Output is correct |
17 |
Correct |
24 ms |
340 KB |
Output is correct |
18 |
Correct |
25 ms |
380 KB |
Output is correct |
19 |
Correct |
2993 ms |
11008 KB |
Output is correct |
20 |
Correct |
2988 ms |
10148 KB |
Output is correct |
21 |
Correct |
2884 ms |
10116 KB |
Output is correct |
22 |
Correct |
2884 ms |
10388 KB |
Output is correct |
23 |
Execution timed out |
3085 ms |
9540 KB |
Time limit exceeded |
24 |
Halted |
0 ms |
0 KB |
- |