#include "bits/stdc++.h"
using namespace std;
void solve(vector<int> v){
int l, r, x;
cin >> l >> r >> x;
for(int i = l; i <= r; ++i){
for(int j = i; j <= r; ++j){
if(v[j] < v[i]) {
if(v[j] + v[i] > x) {
cout << "0\n";
return;
}
}
}
}
cout << 1 << "\n";
}
int main(){
int n, q;
cin >> n >> q;
vector<int> v(n + 1);
for(int i = 1; i <= n; ++i) cin >> v[i];
while(q--){
solve(v);
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
2 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
3 ms |
204 KB |
Output is correct |
7 |
Correct |
3 ms |
204 KB |
Output is correct |
8 |
Correct |
15 ms |
204 KB |
Output is correct |
9 |
Correct |
7 ms |
204 KB |
Output is correct |
10 |
Correct |
7 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
2 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
3 ms |
204 KB |
Output is correct |
7 |
Correct |
3 ms |
204 KB |
Output is correct |
8 |
Correct |
15 ms |
204 KB |
Output is correct |
9 |
Correct |
7 ms |
204 KB |
Output is correct |
10 |
Correct |
7 ms |
204 KB |
Output is correct |
11 |
Correct |
23 ms |
376 KB |
Output is correct |
12 |
Correct |
127 ms |
412 KB |
Output is correct |
13 |
Correct |
92 ms |
420 KB |
Output is correct |
14 |
Correct |
198 ms |
460 KB |
Output is correct |
15 |
Correct |
131 ms |
476 KB |
Output is correct |
16 |
Execution timed out |
3071 ms |
400 KB |
Time limit exceeded |
17 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3063 ms |
9368 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3054 ms |
1092 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
2 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
3 ms |
204 KB |
Output is correct |
7 |
Correct |
3 ms |
204 KB |
Output is correct |
8 |
Correct |
15 ms |
204 KB |
Output is correct |
9 |
Correct |
7 ms |
204 KB |
Output is correct |
10 |
Correct |
7 ms |
204 KB |
Output is correct |
11 |
Correct |
23 ms |
376 KB |
Output is correct |
12 |
Correct |
127 ms |
412 KB |
Output is correct |
13 |
Correct |
92 ms |
420 KB |
Output is correct |
14 |
Correct |
198 ms |
460 KB |
Output is correct |
15 |
Correct |
131 ms |
476 KB |
Output is correct |
16 |
Execution timed out |
3071 ms |
400 KB |
Time limit exceeded |
17 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
2 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
3 ms |
204 KB |
Output is correct |
7 |
Correct |
3 ms |
204 KB |
Output is correct |
8 |
Correct |
15 ms |
204 KB |
Output is correct |
9 |
Correct |
7 ms |
204 KB |
Output is correct |
10 |
Correct |
7 ms |
204 KB |
Output is correct |
11 |
Correct |
23 ms |
376 KB |
Output is correct |
12 |
Correct |
127 ms |
412 KB |
Output is correct |
13 |
Correct |
92 ms |
420 KB |
Output is correct |
14 |
Correct |
198 ms |
460 KB |
Output is correct |
15 |
Correct |
131 ms |
476 KB |
Output is correct |
16 |
Execution timed out |
3071 ms |
400 KB |
Time limit exceeded |
17 |
Halted |
0 ms |
0 KB |
- |