Submission #536111

# Submission time Handle Problem Language Result Execution time Memory
536111 2022-03-12T11:33:37 Z MurotY Hedgehog Daniyar and Algorithms (IZhO19_sortbooks) C++14
0 / 100
427 ms 17896 KB
#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;
}
# 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 427 ms 17896 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 28 ms 1876 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 -