#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;
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 |
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 |
2145 ms |
7288 KB |
Output is correct |
2 |
Correct |
2164 ms |
7120 KB |
Output is correct |
3 |
Correct |
2148 ms |
7336 KB |
Output is correct |
4 |
Correct |
2165 ms |
6944 KB |
Output is correct |
5 |
Incorrect |
2104 ms |
21096 KB |
Output isn't correct |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
193 ms |
2900 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 |
- |