#include <bits/stdc++.h>
#define ios ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ff first
#define ss second
#define ll long long
using namespace std;
const int N=1e6+7, M=1e9+7;
ll a[N], dp[N];
void solve()
{
ll n, m, mn=1e18;
cin >> n >> m;
for (int i=1;i<=n;i++) cin >> a[i], mn=min(mn, a[i]), dp[i]=1;
dp[0]=0;
for (int i=2;i<=n;i++) {
if (a[i] >= a[i-1]) dp[i]+=dp[i-1];
else dp[i]=dp[i-1];
}
// for (int i=1;i<=n;i++) cout << dp[i] <<" ";
while (m--){
ll l, r, k;
cin >> l >> r >> k;
if (mn > k){
if (dp[r]-dp[l-1] == r-l+1) cout <<"1\n";
else cout << "0\n";
continue;
}
/*for (int i=l;i<=r;i++){
ll lw=prev(upper_bound(a+i, a+n+1, a[i]));
}*/
}
return ;
}
int main()
{
ios;
int t=1;
// cin >> t;
while (t--){
solve();
cout <<"\n";
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
524 ms |
17892 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
30 ms |
1924 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |