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;
long long m,n;
long long ar[10000001];
int main(){
cin>>n>>m;
for(long long i=0;i<n;i++) cin>>ar[i];
for(long long i=0;i<m;i++){
long long l,r,k;
cin>>l>>r>>k;
long long maxdif=0;
long long cur=ar[l-1];
for(long long j=l;j<r;j++){
if(cur>=ar[j]){
maxdif=max(maxdif,cur+ar[j]);
}
else{
cur=ar[j];
}
}
if(maxdif>k) cout<<0<<endl;
else cout<<1<<endl;
}
}
# | 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... |