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>
using namespace std;
int main(){
cin.tie(0);
ios::sync_with_stdio(0);
int n,m;
cin>>n>>m;
int w[1000010];
for(int i=0;i<n;i++){
cin>>w[i];
}
for(int i=0;i<m;i++){
int l,r,k,isok=1;
cin>>l>>r>>k;
r--;
l--;
set<int> s;
for(int j=r;j>=l;j--){
if(!s.empty()){
set<int>::iterator q=s.lower_bound(w[j]);
if(q!=s.begin()){
q--;
if(w[j]+*q>k){
cout<<"0\n";
isok=0;
break;
}
}
}
s.insert(w[j]);
}
if(isok){
cout<<"1\n";
}
}
return 0;
}
# | 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... |