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 pb push_back
#define mp make_pair
#define st first
#define nd second
#define pii pair<int,int>
#define N 1000005
#define INF 1e9+5
#define sp " "
#define endl "\n"
#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);
#define all(x) (x).begin(),(x).end()
#define ll long long
using namespace std;
int n,m,w[N],l,r,k;
int main(){
cin >> n >> m;
for(int i=0;i<n;i++){
cin >> w[i];
}
for(int i=0;i<m;i++){
cin >> l >> r >> k;
int mx=0;
for(int j=l;j<=r;j++){
int h=j-1;
while(h>=l&&w[l]<w[h]){
mx=max(mx,w[l]+w[h]);
h--;
}
}
if(mx<=k)
cout << 1 << endl;
else
cout << 0 << 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... |