#include <bits/stdc++.h>
using namespace std;
int main(){
int N, M;
cin >> N >> M;
vector<int> w(N);
for (int i = 0; i < N; i++){
cin >> w[i];
}
for (int i = 0; i < M; i++){
int l, r, k;
cin >> l >> r >> k;
l--;
int mx = 0;
for (int x = l; x < r; x++){
for (int y = x + 1; y < r; y++){
if (w[x] > w[y]){
mx = max(mx, w[x] + w[y]);
}
}
}
if (mx <= k){
cout << 1 << endl;
} else {
cout << 0 << endl;
}
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
300 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
3 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
304 KB |
Output is correct |
5 |
Correct |
2 ms |
300 KB |
Output is correct |
6 |
Correct |
39 ms |
212 KB |
Output is correct |
7 |
Correct |
31 ms |
212 KB |
Output is correct |
8 |
Correct |
39 ms |
212 KB |
Output is correct |
9 |
Correct |
17 ms |
304 KB |
Output is correct |
10 |
Correct |
37 ms |
212 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
300 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
3 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
304 KB |
Output is correct |
5 |
Correct |
2 ms |
300 KB |
Output is correct |
6 |
Correct |
39 ms |
212 KB |
Output is correct |
7 |
Correct |
31 ms |
212 KB |
Output is correct |
8 |
Correct |
39 ms |
212 KB |
Output is correct |
9 |
Correct |
17 ms |
304 KB |
Output is correct |
10 |
Correct |
37 ms |
212 KB |
Output is correct |
11 |
Correct |
1524 ms |
364 KB |
Output is correct |
12 |
Execution timed out |
3028 ms |
340 KB |
Time limit exceeded |
13 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
3068 ms |
14192 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
3077 ms |
1236 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
300 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
3 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
304 KB |
Output is correct |
5 |
Correct |
2 ms |
300 KB |
Output is correct |
6 |
Correct |
39 ms |
212 KB |
Output is correct |
7 |
Correct |
31 ms |
212 KB |
Output is correct |
8 |
Correct |
39 ms |
212 KB |
Output is correct |
9 |
Correct |
17 ms |
304 KB |
Output is correct |
10 |
Correct |
37 ms |
212 KB |
Output is correct |
11 |
Correct |
1524 ms |
364 KB |
Output is correct |
12 |
Execution timed out |
3028 ms |
340 KB |
Time limit exceeded |
13 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
300 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
3 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
304 KB |
Output is correct |
5 |
Correct |
2 ms |
300 KB |
Output is correct |
6 |
Correct |
39 ms |
212 KB |
Output is correct |
7 |
Correct |
31 ms |
212 KB |
Output is correct |
8 |
Correct |
39 ms |
212 KB |
Output is correct |
9 |
Correct |
17 ms |
304 KB |
Output is correct |
10 |
Correct |
37 ms |
212 KB |
Output is correct |
11 |
Correct |
1524 ms |
364 KB |
Output is correct |
12 |
Execution timed out |
3028 ms |
340 KB |
Time limit exceeded |
13 |
Halted |
0 ms |
0 KB |
- |