제출 #1236007

#제출 시각아이디문제언어결과실행 시간메모리
1236007huyverstappenHedgehog Daniyar and Algorithms (IZhO19_sortbooks)C++20
17 / 100
3096 ms6256 KiB

#pragma GCC target ("popcnt,lzcnt,bmi,bmi2,abm")
#include <bits/stdc++.h>
using namespace std;
#define MaxVerstappen "tenbai"
//#define getbit(a,b) ((a>>b)&1) // lay ra bit thu b cua a
#define fir first
#define sec second
#define pii pair<int,int>
const int MOD = 1000000007;

int n, m, x, y, k;
int a[2000005];

int main ()
{

	ios_base::sync_with_stdio(0);
	cin.tie(NULL);

//	freopen(MaxVerstappen".inp", "r", stdin);
//	freopen(MaxVerstappen".out", "w", stdout);
	
	cin >> n >> m;
	for (int i = 1; i <= n; i++) cin >> a[i];
	
	while (m--)
	{
		cin >> x >> y >> k;
		int ama = 0;
		bool ok = 1;
		for (int i = x; i <= y; i++)
		{
			if (i== x) 
			{
				ama = a[i];
				continue;
			}
			if (a[i] + ama > k && ama > a[i]) 
			{
				ok = 0;
				break;
			}
			ama = max(ama, a[i]);
		}
		cout << ok << '\n';
	}
	
}
#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...