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;
#define ll long long
ll wej[1000003];
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
ll n,m;
cin >> n >> m;
for (ll i = 1; i<=n; i++){
cin >> wej[i];
}
for (ll i = 1,a,b,c; i<=m; i++){
cin >> a >> b >> c;
ll mx=0;
for (ll j = a; j<=b; j++){
for (ll u = j; u<=b; u++){
if (wej[j]>wej[u])mx=max(mx,wej[j]+wej[u]);
}
}
if (c>=mx)cout << "1\n";
else cout << "0\n";
}
}
# | 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... |