#include <bits/stdc++.h>
using namespace std;
const int N = 1e6;
int n, m, l[N], r[N], k[N], p[N], a[N];
int main(){
ios::sync_with_stdio(false); cin.tie(nullptr);
cin >> n >> m;
for(int i = 1; i <= n; i++){
cin >> a[i];
p[i] = p[i-1] + (a[i] < a[i-1]);
}
for(int i = 1; i <= m; i++){
cin >> l[i] >> r[i] >> k[i];
int mx = 0, k1 = 0;
for(int j = l[i]; j <= r[i]; j++){
if(mx > a[j]) k1 = max(k1,a[j]+mx);
mx = max(a[j],mx);
}
cout << (k1 <= k[i]) << '\n';
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
460 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
604 KB |
Output is correct |
7 |
Correct |
0 ms |
472 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
460 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
604 KB |
Output is correct |
7 |
Correct |
0 ms |
472 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
2 ms |
604 KB |
Output is correct |
12 |
Correct |
4 ms |
660 KB |
Output is correct |
13 |
Correct |
5 ms |
676 KB |
Output is correct |
14 |
Correct |
9 ms |
704 KB |
Output is correct |
15 |
Correct |
7 ms |
696 KB |
Output is correct |
16 |
Correct |
12 ms |
648 KB |
Output is correct |
17 |
Correct |
8 ms |
604 KB |
Output is correct |
18 |
Correct |
11 ms |
584 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
3098 ms |
8440 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1706 ms |
2548 KB |
Output is correct |
2 |
Execution timed out |
3040 ms |
3408 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
460 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
604 KB |
Output is correct |
7 |
Correct |
0 ms |
472 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
2 ms |
604 KB |
Output is correct |
12 |
Correct |
4 ms |
660 KB |
Output is correct |
13 |
Correct |
5 ms |
676 KB |
Output is correct |
14 |
Correct |
9 ms |
704 KB |
Output is correct |
15 |
Correct |
7 ms |
696 KB |
Output is correct |
16 |
Correct |
12 ms |
648 KB |
Output is correct |
17 |
Correct |
8 ms |
604 KB |
Output is correct |
18 |
Correct |
11 ms |
584 KB |
Output is correct |
19 |
Execution timed out |
3010 ms |
7224 KB |
Time limit exceeded |
20 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
460 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
604 KB |
Output is correct |
7 |
Correct |
0 ms |
472 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
2 ms |
604 KB |
Output is correct |
12 |
Correct |
4 ms |
660 KB |
Output is correct |
13 |
Correct |
5 ms |
676 KB |
Output is correct |
14 |
Correct |
9 ms |
704 KB |
Output is correct |
15 |
Correct |
7 ms |
696 KB |
Output is correct |
16 |
Correct |
12 ms |
648 KB |
Output is correct |
17 |
Correct |
8 ms |
604 KB |
Output is correct |
18 |
Correct |
11 ms |
584 KB |
Output is correct |
19 |
Execution timed out |
3098 ms |
8440 KB |
Time limit exceeded |
20 |
Halted |
0 ms |
0 KB |
- |