#include "bits/stdc++.h"
#include <chrono>
#include <thread>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<pair<ld, int>, null_type,less<pair<ld, int>>, rb_tree_tag,tree_order_statistics_node_update>
#define intt long long
#define int intt
#define pb push_back
#define endl '\n'
#define F first
#define S second
#define pii pair<int,int>
#define pll pair<intt,intt>
#define ld long double
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define all(x) x.begin(), x.end()
using namespace std;
// mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int sz = 2e5+5;
const int sz1 = 2005;
const int mod = 998244353;
const int inf = 2e9+7;
const intt infl = 1e18;
const ld eps = 1e-9;
int a[sz];
int i,j;
void solve(){
int n, m;
cin >> n >> m;
for ( i = 1; i <= n; i++ ) cin >> a[i];
while ( m-- ){
int l, r, k;
cin >> l >> r >> k;
bool flag=true;
for ( i = l; i <= r; i++ ){
for ( j = i+1; j <= r; j++ ){
if ( a[i] > a[j] and a[i]+a[j] > k ) flag=false;
}
}
cout << flag << endl;
}
}
signed main(){
fastio;
int t = 1;
// cin >> t;
for ( int cs = 1; cs <= t; cs++ ) {
// cout << "Case " << cs << ": ";
solve();
}
// while ( cin >> n and n ){
// cin >> m;
// solve();
// }
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |