#include <bits/stdc++.h>
using namespace std;
const int N=1e6+10;
int a[N];
bool ok[N];
int main() {
int n,m;
cin>>n>>m;
ok[0]=1;
for(int i=1; i<=n; i++){
cin>>a[i];
if(ok[i-1] && a[i] >= a[i-1]){
ok[i]=1;
}
}
for(int i=1; i<=m; i++){
int l,r,k;
cin>>l>>r>>k;
bool ans=1;
if(ok[r]){
cout<<ans<<"\n";
continue;
}
for(int i=l; i<r; i++){
if(a[i]>a[i+1]){
ans=0;
break;
}
}
cout<<ans<<"\n";
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
2396 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
2396 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2190 ms |
37072 KB |
Output is correct |
2 |
Correct |
2158 ms |
40000 KB |
Output is correct |
3 |
Correct |
2141 ms |
39800 KB |
Output is correct |
4 |
Correct |
2152 ms |
39880 KB |
Output is correct |
5 |
Correct |
2114 ms |
40152 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
182 ms |
3920 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
2396 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
2396 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |