#include<bits/stdc++.h>
using namespace std;
void solve(){
int n,m;
cin>>n>>m;
vector<int>a(n),dp(n);
dp[0]=0;
for(int i=0;i<n;i++){
cin>>a[i];
if(i>0){
dp[i]=dp[i-1]+(a[i]<a[i-1]);
}
}
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<<(dp[r-1]-dp[l-1]==0)<<'\n';
}
}
signed main(){
int t=1;
// cin>>t;
while(t--){
solve();
cout<<'\n';
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2080 ms |
10132 KB |
Output is correct |
2 |
Correct |
2230 ms |
42952 KB |
Output is correct |
3 |
Correct |
2161 ms |
42940 KB |
Output is correct |
4 |
Correct |
2170 ms |
43200 KB |
Output is correct |
5 |
Correct |
2102 ms |
43084 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
168 ms |
1364 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |