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;
const int maxn=1000;
int w[maxn];
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int n,m;
cin>>n>>m;
for(int i=0;i<n;i++)cin>>w[i];
for(;m;m--){
int l,r,k;
cin>>l>>r>>k;
l--;r--;
bool ok=true;
for(int i=l;i<=r;i++){
for(int j=i+1;j<=r;j++){
if(w[i]>w[j]){
if(w[i]+w[j]>k){
ok=false;
}
}
}
}
if(ok) cout<<1<<"\n";
else cout<<0<<"\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... |