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 fr first
#define sc second
typedef long long ll;
const int MAX = 1e6 + 10;
const int INF = 0x3f3f3f3f;
int n, m, a[MAX];
int query(int l, int r, int k){
int mx = 0;
for(int i = l; i <= r; i++)
for(int j = i + 1; j <= r; j++)
if(a[i] > a[j]) mx = max(mx, a[i] + a[j]);
return (mx <= k);
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cin >> n >> m;
for(int i = 1; i <= n; i++)
cin >> a[i];
while(m--){
int l, r, k; cin >> l >> r >> k;
cout << query(l, r, k) << '\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... |