| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1357455 | gay | Gift Exchange (JOI24_ho_t4) | C++20 | 2594 ms | 1988 KiB |
#include <bits/stdc++.h>
#include <experimental/random>
#include <random>
//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
using namespace std;
using ld = long double;
using ll = long long;
const ll INF = 3e18, MOD = 1e9 + 7;
void solve();
signed main() {
#ifdef LOCAL
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
ios::sync_with_stdio(false);
cin.tie(0);
int q = 1;
//cin >> q;
while (q--) {
solve();
}
}
void solve() {
ll n; cin >> n;
vector<ll> a(n);
for (int i = 0; i < n; i++) {
cin >> a[i];
}
vector<ll> b(n);
for (int i = 0; i < n; i++) {
cin >> b[i];
}
ll q; cin >> q;
while (q--) {
ll l, r; cin >> l >> r;
l--, r--;
bool flag = true;
for (ll i = l; i <= r; i++) {
bool f = false;
for (ll j = l; j <= r; j++) {
if (i == j) continue;
if ((b[j] >= b[i] && b[j] <= a[i]) || (b[j] <= b[i] && a[j] >= b[i])) {
f = true;
break;
}
}
if (!f) {
flag = false;
break;
}
}
if (flag) {
cout << "Yes\n";
} else {
cout << "No\n";
}
}
}
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
