# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1094536 | I_am_Polish_Girl | Gift Exchange (JOI24_ho_t4) | C++14 | 2578 ms | 6044 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#pragma GCC optimize("Ofast")
#pragma GCC optimize("O3")
#pragma GCC optimization ("unroll-loops")
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <queue>
#include <cmath>
#include <random>
#include <chrono>
#include <iomanip>
#include <iostream>
#include <bitset>
#include <cmath>
#define int long long
using namespace std;
int log_ = 3;
int inf = 2000000007000000007;
int mod = 1000000007;
int p = 501;
signed main()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int n;
cin >> n;
vector <int> a(n);
for (int i = 0; i < n; i++)
cin >> a[i];
vector <int> b(n);
for (int i = 0; i < n; i++)
cin >> b[i];
int q;
cin >> q;
while (q--)
{
int l, r;
cin >> l >> r;
l--;
r--;
vector <pair <int, int>> vp;
for (int i = l; i <= r; i++)
{
vp.push_back({ a[i] , b[i]});
}
sort(vp.begin(), vp.end());
int c = 0;
for (int i = 0; i < vp.size(); i++)
{
if (i >= 1)
{
if (vp[i - 1].first >= vp[i].second)
continue;
}
if (i < vp.size() - 1)
{
if (vp[i].first >= vp[i+1].second)
continue;
}
c = 1;
}
if (c > 0)
cout << "No\n";
else
cout << "Yes\n";
}
}
Compilation message (stderr)
# | 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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |