#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 (l == r) {
cout << "1\n";
continue;
}
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;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
450 ms |
17892 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
27 ms |
1876 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |