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>
#define fastio ios :: sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define ll long long
using namespace std;
const int mxN = 1e6 + 45, mod = 1e9 + 7;
const ll inf = 2e18 + 43;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
int n, m, w[mxN];
int main() {
fastio;
cin >> n >> m;
for (int i = 1; i <= m; ++i) cin >> w[i];
if (m <= 5000) {
while (m--) {
int l, r, k;
cin >> l >> r >> k;
int mx = w[l];
bool bad = 0;
for (int i = l + 1; i <= r; ++i) {
if (mx > w[i] && mx + w[i] > k) {
bad = 1;
break;
}
mx = max(mx, w[i]);
}
cout << bad << '\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... |