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 work_with_io ios::sync_with_stdio(0);cin.tie(0);
//#define int long long
void solve() {
int n, m;
cin >> n >> m;
int a[n];
for (int i = 0; i < n; i++) {
cin >> a[i];
}
for (int tmp=m;tmp--;) {
int l, r, k;
cin >> l >> r >> k;
l--;r--;
int ans = 1;
for (int left = l; left <= r; left++) {
for (int right = left + 1; right <= r; right++) {
if (a[left] > a[right] && a[left] + a[right] > k)
ans = 0;
}
}
cout << ans << '\n';
}
return;
}
signed main() {
//std::work_with_io;
int q = 1;
//cin >> q;
while (q--) {
solve();
}
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... |