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 m,n;
int ar[1000001];
int main(){
cin>>n>>m;
for(int i=0;i<n;i++) cin>>ar[i];
for(int i=0;i<m;i++){
int l,r,k;
cin>>l>>r>>k;
int maxdif=0;
int cur=ar[l-1];
for(int 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... |