#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
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 |
328 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 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 |
328 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
3 ms |
340 KB |
Output is correct |
12 |
Correct |
2 ms |
468 KB |
Output is correct |
13 |
Correct |
2 ms |
464 KB |
Output is correct |
14 |
Correct |
3 ms |
468 KB |
Output is correct |
15 |
Correct |
3 ms |
456 KB |
Output is correct |
16 |
Correct |
14 ms |
460 KB |
Output is correct |
17 |
Correct |
13 ms |
448 KB |
Output is correct |
18 |
Correct |
11 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
525 ms |
11904 KB |
Output is correct |
2 |
Correct |
538 ms |
10240 KB |
Output is correct |
3 |
Correct |
489 ms |
10168 KB |
Output is correct |
4 |
Correct |
509 ms |
10392 KB |
Output is correct |
5 |
Execution timed out |
3044 ms |
8916 KB |
Time limit exceeded |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
589 ms |
1244 KB |
Output is correct |
2 |
Correct |
1954 ms |
1380 KB |
Output is correct |
3 |
Execution timed out |
3063 ms |
1440 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 |
328 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
3 ms |
340 KB |
Output is correct |
12 |
Correct |
2 ms |
468 KB |
Output is correct |
13 |
Correct |
2 ms |
464 KB |
Output is correct |
14 |
Correct |
3 ms |
468 KB |
Output is correct |
15 |
Correct |
3 ms |
456 KB |
Output is correct |
16 |
Correct |
14 ms |
460 KB |
Output is correct |
17 |
Correct |
13 ms |
448 KB |
Output is correct |
18 |
Correct |
11 ms |
340 KB |
Output is correct |
19 |
Correct |
2201 ms |
2468 KB |
Output is correct |
20 |
Correct |
2260 ms |
2392 KB |
Output is correct |
21 |
Execution timed out |
3093 ms |
2192 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 |
328 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
3 ms |
340 KB |
Output is correct |
12 |
Correct |
2 ms |
468 KB |
Output is correct |
13 |
Correct |
2 ms |
464 KB |
Output is correct |
14 |
Correct |
3 ms |
468 KB |
Output is correct |
15 |
Correct |
3 ms |
456 KB |
Output is correct |
16 |
Correct |
14 ms |
460 KB |
Output is correct |
17 |
Correct |
13 ms |
448 KB |
Output is correct |
18 |
Correct |
11 ms |
340 KB |
Output is correct |
19 |
Correct |
525 ms |
11904 KB |
Output is correct |
20 |
Correct |
538 ms |
10240 KB |
Output is correct |
21 |
Correct |
489 ms |
10168 KB |
Output is correct |
22 |
Correct |
509 ms |
10392 KB |
Output is correct |
23 |
Execution timed out |
3044 ms |
8916 KB |
Time limit exceeded |
24 |
Halted |
0 ms |
0 KB |
- |