This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned ll
#define pll pair<ll,ll>
#define pii pair<int,int>
#define f first
#define s second
#define pb push_back
#define epb emplace back
#define inf 1e9+1
#define linf 1e18+1
using namespace std;
void solve(){
int n,m;cin>>n>>m;
int a[n+1];
for(int i=1;i<=n;i++)cin>>a[i];
while(m--){
int l,r,x;cin>>l>>r>>x;
bool ind=true;
for(int i=l+1;i<=r;i++){
for(int j=i-1;j<i;j++){
if(a[j]>a[i]){
if(a[j]+a[i]>x)ind=false;
}
}
}
if(ind)cout<<1<<"\n";
else cout<<0<<"\n";
}
}
int main(){
ios_base::sync_with_stdio(false);cin.tie(0);
//freopen("in.in","r",stdin);freopen("out.out","w",stdout);
int test=1;//cin>>test;
while(test--){
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... |