#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define sz size()
#define in insert
#define int long long
#define F first
#define up upper_bound
#define S second
#define lb lower_bound
#define pair pair<int, int>
#define all(v) v.begin(),v.end()
#define FOR1(x, n) for(int j = x; j <= n; j ++)
#define FOR(x, n) for(int i = x; i <= n; i ++)
#define FORR(x, n) for(int j = x; j >= n; j --)
#define nikita ios_base::sync_with_stdio(0), cin.tie(0);
int n,m,k,t,sum=0,cnt, l,ans = 0, r, x, y, q;
const int N = 2e5+5;
set<int>g[N];
int a[N], b[N];
bool f;
void solve() {
nikita
cin >> n >> m;
FOR(1, n)cin >> a[i];
l = 1;
FOR(1, m){
cin >> l >> r >> k;
f=0;
set<int, greater<int>>st;
st.in(a[r]);
st.in(0);
FORR(r-1, l){
if(a[j] != 0)x = *st.up(a[j]);
else continue;
if(x + a[j] > k){
f = 1;
break;
}
st.in(a[j]);
}
if(f)cout << "0\n";
else cout << "1\n";
}
}
signed main() {
nikita
int t=1;
FOR(1, t)solve();
}
Compilation message
sortbooks.c:1:10: fatal error: bits/stdc++.h: No such file or directory
1 | #include <bits/stdc++.h>
| ^~~~~~~~~~~~~~~
compilation terminated.