#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pll pair<ll,ll>
#define pii pair<int,int>
#define fs first
#define sc second
#define tlll tuple<ll,ll,ll>
const int mxn = 1e6+10;
vector<pii> op[mxn];
int arr[mxn];
int N,Q;
bitset<mxn> ans;
int main(){
ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
cin>>N>>Q;
for(int i = 1;i<=N;i++){
cin>>arr[i];
}
for(int i = 1;i<=Q;i++){
int s,e,k;
cin>>s>>e>>k;
op[e].push_back(pii(s,i));
}
int pre = 0;
for(int i = 1;i<=N;i++){
if(arr[i]<arr[i-1])pre = i;
for(auto &j:op[i]){
ans[j.sc] = (pre>j.fs?0:1);
}
}
for(int i = 1;i<=Q;i++){
cout<<ans[i]<<'\n';
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
10 ms |
25840 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
10 ms |
25840 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
581 ms |
71628 KB |
Output is correct |
2 |
Correct |
561 ms |
82552 KB |
Output is correct |
3 |
Correct |
567 ms |
82508 KB |
Output is correct |
4 |
Correct |
583 ms |
82444 KB |
Output is correct |
5 |
Correct |
587 ms |
82772 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
42 ms |
29780 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
10 ms |
25840 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
10 ms |
25840 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |