#include<bits/stdc++.h>
using namespace std;
void solve(){
int n,m;
cin>>n>>m;
vector<int>a(n);
for(int i=0;i<n;i++) cin>>a[i];
while(m--){
int l,r,k;
cin>>l>>r>>k;
--l;
int mx=0;
bool ans=true;
for(int i=l;i<r;i++){
mx=max(a[i],mx);
if(mx>a[i] && mx+a[i]>k) ans=false;
}
cout<<ans<<'\n';
}
}
signed main(){
int t=1;
// cin>>t;
while(t--){
solve();
cout<<'\n';
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
448 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
1 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 |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
448 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
6 ms |
348 KB |
Output is correct |
12 |
Correct |
8 ms |
560 KB |
Output is correct |
13 |
Correct |
9 ms |
348 KB |
Output is correct |
14 |
Correct |
20 ms |
608 KB |
Output is correct |
15 |
Correct |
16 ms |
604 KB |
Output is correct |
16 |
Correct |
19 ms |
564 KB |
Output is correct |
17 |
Correct |
15 ms |
348 KB |
Output is correct |
18 |
Correct |
17 ms |
444 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
3070 ms |
14576 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1732 ms |
2920 KB |
Output is correct |
2 |
Execution timed out |
3037 ms |
2132 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 |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
448 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
6 ms |
348 KB |
Output is correct |
12 |
Correct |
8 ms |
560 KB |
Output is correct |
13 |
Correct |
9 ms |
348 KB |
Output is correct |
14 |
Correct |
20 ms |
608 KB |
Output is correct |
15 |
Correct |
16 ms |
604 KB |
Output is correct |
16 |
Correct |
19 ms |
564 KB |
Output is correct |
17 |
Correct |
15 ms |
348 KB |
Output is correct |
18 |
Correct |
17 ms |
444 KB |
Output is correct |
19 |
Execution timed out |
3006 ms |
5292 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 |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
448 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
6 ms |
348 KB |
Output is correct |
12 |
Correct |
8 ms |
560 KB |
Output is correct |
13 |
Correct |
9 ms |
348 KB |
Output is correct |
14 |
Correct |
20 ms |
608 KB |
Output is correct |
15 |
Correct |
16 ms |
604 KB |
Output is correct |
16 |
Correct |
19 ms |
564 KB |
Output is correct |
17 |
Correct |
15 ms |
348 KB |
Output is correct |
18 |
Correct |
17 ms |
444 KB |
Output is correct |
19 |
Execution timed out |
3070 ms |
14576 KB |
Time limit exceeded |
20 |
Halted |
0 ms |
0 KB |
- |