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 N = 1e6;
int n, m, l[N], r[N], k[N], p[N], a[N];
int main(){
ios::sync_with_stdio(false); cin.tie(nullptr);
cin >> n >> m;
for(int i = 1; i <= n; i++){
cin >> a[i];
p[i] = p[i-1] + (a[i] < a[i-1]);
}
for(int i = 1; i <= m; i++){
cin >> l[i] >> r[i] >> k[i];
int mx = 0, k1 = 0;
for(int j = l[i]; j <= r[i]; j++){
if(mx > a[j]) k1 = max(k1,a[j]+mx);
mx = max(a[j],mx);
}
cout << (k1 <= k[i]) << '\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... |