#include <bits/stdc++.h>
using namespace std;
const int N=1e6+10;
int a[N];
bool sorted[N];
int main() {
int n,m;
cin>>n>>m;
sorted[0]=true;
for(int i=1; i<=n; i++)
{
cin>>a[i];
if(sorted[i-1] && a[i] >= a[i-1])sorted[i]=true;
}
for(int i=1; i<=m; i++){
int l,r,k;
cin>>l>>r>>k;
bool ans=true;
if(sorted[r]){
cout<<ans<<endl;
continue;
}
for(int i=l; i<r; i++){
if(a[i] > a[i+1]){
ans=false;
break;
}
}
cout<<ans<<endl;
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
2396 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
2396 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2159 ms |
6992 KB |
Output is correct |
2 |
Correct |
2120 ms |
7080 KB |
Output is correct |
3 |
Correct |
2127 ms |
7312 KB |
Output is correct |
4 |
Correct |
2131 ms |
6888 KB |
Output is correct |
5 |
Correct |
2135 ms |
7152 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
187 ms |
2644 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
2396 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
2396 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |