#include <bits/stdc++.h>
#define ll long long
#define fort(x , y) for(int y = 1 ; y <= x ; y++)
#define pb push_back
#define pf push_front
#define ppb pop_back
#define int long long
#define F first
#define S second
using namespace std;
const int N = 1e6 + 5;
const int NN = 1e9 + 7;
int n,m,a[N],k[N],l[N],r[N],s[N],cnt;
signed main(){
ios_base::sync_with_stdio(0);
cin.tie(0);cout.tie(0);
cin >> n >> m;
for(int i = 1 ; i <= n ; i++){
cin >> a[i];
}
cnt = 1;
for(int i = 1 ; i < n ; i++){
if(a[i] <= a[i + 1]){
s[i] = cnt;
s[i + 1] = cnt;
}
else{
cnt++;
}
}
for(int j = 1 ; j <= m ; j++){
cin >> l[j] >> r[j] >> k[j];
if(l[j] == r[j]){
cout << 1 << '\n';
continue;
}
bool ok = 0;
if(s[l[j]] == s[r[j]]){
ok = 1;
}
if(ok){
cout << 1 << '\n';
}
else{
cout << 0 << '\n';
}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
8536 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
8536 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
393 ms |
41468 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
30 ms |
13144 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
8536 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
8536 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |