#include <bits/stdc++.h>
//
#pragma comment(linker, "/stack:200000000")
//
#pragma GCC optimize("Ofast")
//
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#define pb push_back
#define pii pair <int, int>
#define ll long long
#define ld long double
#define x first
#define y second
#define all(v) v.begin(),v.end()
#define sz(s) (int)s.size()
#define skip continue
using namespace std;
const int N = 4e5 + 7;
const int inf = 1e9 + 7;
const ll INF = 1e18 + 7;
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define int ll
int n, m, k;
void f(vector <pii> &v) {
vector <int> vx, vy;
for (auto p : v)vx.pb(p.x), vy.pb(p.y);
sort(all(vx)), sort(all(vy));
map <int, int> id;
int last = -inf, pos = 0;
for (auto x : vx) {
if (x == last)skip;
id[x] = ++pos, last = x;
}
for (auto &p : v)p.x = id[p.x];
last = -inf, pos = 0, id.clear();
for (auto y : vy) {
if (y == last)skip;
id[y] = ++pos, last = y;
}
for (auto &p : v)p.y = id[p.y];
}
void solve() {
cin >> n >> m >> k;
set <pii> st;
vector <pii> v;
for (int i = 1;i <= k;i++) {
int x, y;
cin >> x >> y;
v.pb({x, y});
}
int q;
cin >> q;
while (q--) {
pii s, f;
cin >> s.x >> s.y >> f.x >> f.y;
v.pb(s), v.pb(f);
}
f(v);
for (int i = 0;i < k;i++)st.insert({v[i].x, v[i].y});
for (int i = 0;i < (sz(v) - k) / 2;i++) {
pii s, f;
s = v[k + 2 * i], f = v[k + 2 * i + 1];
//cin >> s.x >> s.y >> f.x >> f.y;
while (s.x <= f.x && s.y <= f.y) {
if (st.count(s) && s.x < f.x) {
s.x++;
skip;
}
if (s.y < f.y) {
s.y++;
skip;
}
break;
}
cout << (s == f ? "Yes" : "No") << '\n';
}
}
signed main() {
//srand(time(NULL));
ios_base::sync_with_stdio(0);
cin.tie(0);
int test = 1;
//cin >> test;
for (int t = 1;t <= test;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... |