#include <iostream>
#define sum(a, b) ( (a) + (b) )
using namespace std;
int n, m, a[2000006], t[2000006];
void build(int v, int l, int r){
if(l == r){
t[v] = a[l];
return;
}
}
int main()
{
cin >> n >> m;
for(int i = 0; i < n; i++){
cin >> a[i];
}
for(int i = 0; i < m; i++){
int l, r, s, mx, q = 0;
cin >> l >> r >> s;
--l; --r;
mx = a[l];
for(int j = l; j <= r; j++){
if(a[j] >= mx){
mx = a[j];
}
else {
if(a[j] + mx > s){
cout << 0;
q = 1;
break;
}
}
}
if(q == 0) cout << 1;
cout << endl;
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
4 ms |
256 KB |
Output is correct |
4 |
Correct |
3 ms |
376 KB |
Output is correct |
5 |
Correct |
3 ms |
376 KB |
Output is correct |
6 |
Correct |
5 ms |
376 KB |
Output is correct |
7 |
Correct |
4 ms |
248 KB |
Output is correct |
8 |
Correct |
4 ms |
376 KB |
Output is correct |
9 |
Correct |
4 ms |
376 KB |
Output is correct |
10 |
Correct |
4 ms |
256 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
4 ms |
256 KB |
Output is correct |
4 |
Correct |
3 ms |
376 KB |
Output is correct |
5 |
Correct |
3 ms |
376 KB |
Output is correct |
6 |
Correct |
5 ms |
376 KB |
Output is correct |
7 |
Correct |
4 ms |
248 KB |
Output is correct |
8 |
Correct |
4 ms |
376 KB |
Output is correct |
9 |
Correct |
4 ms |
376 KB |
Output is correct |
10 |
Correct |
4 ms |
256 KB |
Output is correct |
11 |
Correct |
16 ms |
380 KB |
Output is correct |
12 |
Correct |
17 ms |
376 KB |
Output is correct |
13 |
Correct |
20 ms |
376 KB |
Output is correct |
14 |
Correct |
28 ms |
376 KB |
Output is correct |
15 |
Correct |
27 ms |
376 KB |
Output is correct |
16 |
Correct |
32 ms |
408 KB |
Output is correct |
17 |
Correct |
31 ms |
380 KB |
Output is correct |
18 |
Correct |
29 ms |
376 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
3032 ms |
5552 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
811 ms |
1104 KB |
Output is correct |
2 |
Correct |
1683 ms |
948 KB |
Output is correct |
3 |
Execution timed out |
3005 ms |
1108 KB |
Time limit exceeded |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
4 ms |
256 KB |
Output is correct |
4 |
Correct |
3 ms |
376 KB |
Output is correct |
5 |
Correct |
3 ms |
376 KB |
Output is correct |
6 |
Correct |
5 ms |
376 KB |
Output is correct |
7 |
Correct |
4 ms |
248 KB |
Output is correct |
8 |
Correct |
4 ms |
376 KB |
Output is correct |
9 |
Correct |
4 ms |
376 KB |
Output is correct |
10 |
Correct |
4 ms |
256 KB |
Output is correct |
11 |
Correct |
16 ms |
380 KB |
Output is correct |
12 |
Correct |
17 ms |
376 KB |
Output is correct |
13 |
Correct |
20 ms |
376 KB |
Output is correct |
14 |
Correct |
28 ms |
376 KB |
Output is correct |
15 |
Correct |
27 ms |
376 KB |
Output is correct |
16 |
Correct |
32 ms |
408 KB |
Output is correct |
17 |
Correct |
31 ms |
380 KB |
Output is correct |
18 |
Correct |
29 ms |
376 KB |
Output is correct |
19 |
Correct |
2506 ms |
1764 KB |
Output is correct |
20 |
Correct |
2477 ms |
1664 KB |
Output is correct |
21 |
Execution timed out |
3100 ms |
1460 KB |
Time limit exceeded |
22 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
4 ms |
256 KB |
Output is correct |
4 |
Correct |
3 ms |
376 KB |
Output is correct |
5 |
Correct |
3 ms |
376 KB |
Output is correct |
6 |
Correct |
5 ms |
376 KB |
Output is correct |
7 |
Correct |
4 ms |
248 KB |
Output is correct |
8 |
Correct |
4 ms |
376 KB |
Output is correct |
9 |
Correct |
4 ms |
376 KB |
Output is correct |
10 |
Correct |
4 ms |
256 KB |
Output is correct |
11 |
Correct |
16 ms |
380 KB |
Output is correct |
12 |
Correct |
17 ms |
376 KB |
Output is correct |
13 |
Correct |
20 ms |
376 KB |
Output is correct |
14 |
Correct |
28 ms |
376 KB |
Output is correct |
15 |
Correct |
27 ms |
376 KB |
Output is correct |
16 |
Correct |
32 ms |
408 KB |
Output is correct |
17 |
Correct |
31 ms |
380 KB |
Output is correct |
18 |
Correct |
29 ms |
376 KB |
Output is correct |
19 |
Execution timed out |
3032 ms |
5552 KB |
Time limit exceeded |
20 |
Halted |
0 ms |
0 KB |
- |