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 t,n,m,q,ans,sum,ct,l,r,a[200005],b[200005],ans1,ans2;
string s;
bool g[2005];
int main() {
ios::sync_with_stdio(false);
cin >> n >> m;
for (int i=1;i<=n;i++){
cin >> a[i];
}
for (int i=1;i<=m;i++){
cin >> l >> r >> ct;
sum=0; ans=0;
for (int j=l;j<=r;j++){
ans=max(ans,a[j]);
if (ans != a[j])
sum=max(sum,ans+a[j]);
}
if (sum <= ct)
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... |