제출 #1235994

#제출 시각아이디문제언어결과실행 시간메모리
1235994thunoproHedgehog Daniyar and Algorithms (IZhO19_sortbooks)C++20
17 / 100
3095 ms1024 KiB
#include <bits/stdc++.h>
#define hash _hash_
#define y1 _y1_
#define next _next_
using namespace std;

using ll = long long;

/* -------------I alone decide my fate!---------------*/
/*   I just do what I gotta, in the heat of the summer    */

int N, Q, a[100009];

void solve() {
	cin >> N >> Q;
	for (int i = 1; i <= N; i ++) {
		cin >> a[i];
	}
	while (Q --) {
		int l, r, k; cin >> l >> r >> k;
		bool ok = 1;
		int ma = 0;
		for (int i = l; i < r; i ++ ){
			ma = max(ma, a[i]);
			if (a[i + 1] < ma) {
				if (ma + a[i + 1] > k) ok = 0;
			}
		}
		cout << ok << "\n";
	}
}


int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	solve();
}

/*
  How can you see into my eyes, like open doors?
  Leading you down into my core, where I've become so numb
  Without a soul, my spirit's sleeping somewhere cold
  Until you find it here and bring it back home!
  Wake me up! Wake me up inside
  Cant wake up? Wake me up inside
*/
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...