| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1352181 | fggg | Hedgehog Daniyar and Algorithms (IZhO19_sortbooks) | C++20 | 3095 ms | 16096 KiB |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
void solve() {
ll n, q;
cin >> n >> q;
vector<ll> a(n);
for (ll& x : a) cin >> x;
while (q--) {
ll l, r, k;
cin >> l >> r >> k;
l--, r--;
vector<ll> b = a;
ll ans = 1;
for (ll _ = 0; _ < r - l; _++) {
ll pmi = l + _;
for (ll j = l + _; j <= r; j++) {
if (b[j] < b[pmi]) pmi = j;
}
for (ll j = pmi - 1; j >= l + _; j--) {
if (b[pmi] + b[j] > k) ans = 0;
}
}
cout << ans << '\n';
}
}
signed main() {
cin.tie(nullptr);
ios_base::sync_with_stdio(false);
ll t = 1;
//cin >> t;
while (t--) {
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... | ||||
