#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int n,q; cin>>n>>q;
vector<int> v(n); for(int& i : v) cin>>i;
while(q--){
int l,r,k; cin>>l>>r>>k; l--; r--;
int mx = 0;
for(int i = l; i <= r; i++){
for(int j = i+1; j<=r; j++){
if(v[i] > v[j]) mx = max(mx,v[i] + v[j]); // ill have to swap them
}
}
if(mx > k) cout<<0<<endl;
else cout<<1<<endl;
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
2 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
456 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
21 ms |
464 KB |
Output is correct |
7 |
Correct |
21 ms |
348 KB |
Output is correct |
8 |
Correct |
27 ms |
348 KB |
Output is correct |
9 |
Correct |
8 ms |
344 KB |
Output is correct |
10 |
Correct |
23 ms |
460 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
2 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
456 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
21 ms |
464 KB |
Output is correct |
7 |
Correct |
21 ms |
348 KB |
Output is correct |
8 |
Correct |
27 ms |
348 KB |
Output is correct |
9 |
Correct |
8 ms |
344 KB |
Output is correct |
10 |
Correct |
23 ms |
460 KB |
Output is correct |
11 |
Correct |
1045 ms |
508 KB |
Output is correct |
12 |
Execution timed out |
3094 ms |
344 KB |
Time limit exceeded |
13 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3005 ms |
4184 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3010 ms |
856 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
2 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
456 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
21 ms |
464 KB |
Output is correct |
7 |
Correct |
21 ms |
348 KB |
Output is correct |
8 |
Correct |
27 ms |
348 KB |
Output is correct |
9 |
Correct |
8 ms |
344 KB |
Output is correct |
10 |
Correct |
23 ms |
460 KB |
Output is correct |
11 |
Correct |
1045 ms |
508 KB |
Output is correct |
12 |
Execution timed out |
3094 ms |
344 KB |
Time limit exceeded |
13 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
2 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
456 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
21 ms |
464 KB |
Output is correct |
7 |
Correct |
21 ms |
348 KB |
Output is correct |
8 |
Correct |
27 ms |
348 KB |
Output is correct |
9 |
Correct |
8 ms |
344 KB |
Output is correct |
10 |
Correct |
23 ms |
460 KB |
Output is correct |
11 |
Correct |
1045 ms |
508 KB |
Output is correct |
12 |
Execution timed out |
3094 ms |
344 KB |
Time limit exceeded |
13 |
Halted |
0 ms |
0 KB |
- |