#include<bits/stdc++.h>
using namespace std;
int main(){
cin.tie(0);
ios::sync_with_stdio(0);
int n,m;
cin>>n>>m;
int w[1000010];
for(int i=0;i<n;i++){
cin>>w[i];
}
for(int i=0;i<m;i++){
int l,r,k,isok=1;
cin>>l>>r>>k;
r--;
l--;
set<int> s;
for(int j=r;j>=l;j--){
if(!s.empty()){
set<int>::iterator q=s.lower_bound(w[j]);
if(q!=s.begin()){
q--;
if(w[j]+*q>k){
cout<<"0\n";
isok=0;
break;
}
}
}
s.insert(w[j]);
}
if(isok){
cout<<"1\n";
}
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
4180 KB |
Output is correct |
2 |
Correct |
2 ms |
4232 KB |
Output is correct |
3 |
Correct |
2 ms |
4180 KB |
Output is correct |
4 |
Correct |
3 ms |
4180 KB |
Output is correct |
5 |
Correct |
2 ms |
4180 KB |
Output is correct |
6 |
Correct |
3 ms |
4180 KB |
Output is correct |
7 |
Correct |
3 ms |
4240 KB |
Output is correct |
8 |
Correct |
11 ms |
4240 KB |
Output is correct |
9 |
Correct |
6 ms |
4236 KB |
Output is correct |
10 |
Correct |
3 ms |
4180 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
4180 KB |
Output is correct |
2 |
Correct |
2 ms |
4232 KB |
Output is correct |
3 |
Correct |
2 ms |
4180 KB |
Output is correct |
4 |
Correct |
3 ms |
4180 KB |
Output is correct |
5 |
Correct |
2 ms |
4180 KB |
Output is correct |
6 |
Correct |
3 ms |
4180 KB |
Output is correct |
7 |
Correct |
3 ms |
4240 KB |
Output is correct |
8 |
Correct |
11 ms |
4240 KB |
Output is correct |
9 |
Correct |
6 ms |
4236 KB |
Output is correct |
10 |
Correct |
3 ms |
4180 KB |
Output is correct |
11 |
Correct |
7 ms |
4304 KB |
Output is correct |
12 |
Correct |
9 ms |
4372 KB |
Output is correct |
13 |
Correct |
9 ms |
4436 KB |
Output is correct |
14 |
Correct |
14 ms |
4468 KB |
Output is correct |
15 |
Correct |
12 ms |
4436 KB |
Output is correct |
16 |
Correct |
1313 ms |
4564 KB |
Output is correct |
17 |
Correct |
1018 ms |
4504 KB |
Output is correct |
18 |
Correct |
58 ms |
4288 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
544 ms |
6312 KB |
Output is correct |
2 |
Correct |
590 ms |
39096 KB |
Output is correct |
3 |
Correct |
613 ms |
38896 KB |
Output is correct |
4 |
Correct |
582 ms |
39088 KB |
Output is correct |
5 |
Execution timed out |
3087 ms |
53384 KB |
Time limit exceeded |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
3063 ms |
4308 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
4180 KB |
Output is correct |
2 |
Correct |
2 ms |
4232 KB |
Output is correct |
3 |
Correct |
2 ms |
4180 KB |
Output is correct |
4 |
Correct |
3 ms |
4180 KB |
Output is correct |
5 |
Correct |
2 ms |
4180 KB |
Output is correct |
6 |
Correct |
3 ms |
4180 KB |
Output is correct |
7 |
Correct |
3 ms |
4240 KB |
Output is correct |
8 |
Correct |
11 ms |
4240 KB |
Output is correct |
9 |
Correct |
6 ms |
4236 KB |
Output is correct |
10 |
Correct |
3 ms |
4180 KB |
Output is correct |
11 |
Correct |
7 ms |
4304 KB |
Output is correct |
12 |
Correct |
9 ms |
4372 KB |
Output is correct |
13 |
Correct |
9 ms |
4436 KB |
Output is correct |
14 |
Correct |
14 ms |
4468 KB |
Output is correct |
15 |
Correct |
12 ms |
4436 KB |
Output is correct |
16 |
Correct |
1313 ms |
4564 KB |
Output is correct |
17 |
Correct |
1018 ms |
4504 KB |
Output is correct |
18 |
Correct |
58 ms |
4288 KB |
Output is correct |
19 |
Execution timed out |
3050 ms |
15192 KB |
Time limit exceeded |
20 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
4180 KB |
Output is correct |
2 |
Correct |
2 ms |
4232 KB |
Output is correct |
3 |
Correct |
2 ms |
4180 KB |
Output is correct |
4 |
Correct |
3 ms |
4180 KB |
Output is correct |
5 |
Correct |
2 ms |
4180 KB |
Output is correct |
6 |
Correct |
3 ms |
4180 KB |
Output is correct |
7 |
Correct |
3 ms |
4240 KB |
Output is correct |
8 |
Correct |
11 ms |
4240 KB |
Output is correct |
9 |
Correct |
6 ms |
4236 KB |
Output is correct |
10 |
Correct |
3 ms |
4180 KB |
Output is correct |
11 |
Correct |
7 ms |
4304 KB |
Output is correct |
12 |
Correct |
9 ms |
4372 KB |
Output is correct |
13 |
Correct |
9 ms |
4436 KB |
Output is correct |
14 |
Correct |
14 ms |
4468 KB |
Output is correct |
15 |
Correct |
12 ms |
4436 KB |
Output is correct |
16 |
Correct |
1313 ms |
4564 KB |
Output is correct |
17 |
Correct |
1018 ms |
4504 KB |
Output is correct |
18 |
Correct |
58 ms |
4288 KB |
Output is correct |
19 |
Correct |
544 ms |
6312 KB |
Output is correct |
20 |
Correct |
590 ms |
39096 KB |
Output is correct |
21 |
Correct |
613 ms |
38896 KB |
Output is correct |
22 |
Correct |
582 ms |
39088 KB |
Output is correct |
23 |
Execution timed out |
3087 ms |
53384 KB |
Time limit exceeded |
24 |
Halted |
0 ms |
0 KB |
- |