#include <bits/stdc++.h>
//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx,avx2,fma")
using namespace std;
#define sped_up ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
const ll INF = (ll)1e9 + 1, INFL = (ll)1e18 + 1;
const ll mod = (ll)1e9 + 7, MAXN = (ll)0;
int main () {
sped_up;
ll n, m, k;
cin >> n >> m >> k;
map <ll, vector <ll>> mp;
for (int i = 1; i <= k; i++) {
ll x, y;
cin >> x >> y;
mp[x].push_back(y);
}
for (auto i : mp) {
sort(i.second.begin(), i.second.end());
}
ll q;
cin >> q;
while (q--) {
ll x1, y1, x2, y2;
cin >> x1 >> y1 >> x2 >> y2;
ll nwx = x1;
ll nwy = y1;
while (true) {
ll no = 1;
if (nwx == x2 && nwy <= y2) {
cout << "Yes\n";
break;
}
if (nwx == x2 && nwy > y2) {
cout << "No\n";
break;
}
for (auto i : mp[nwx]) {
if (nwy <= i) {
nwy = i;
no = 0;
break;
}
}
if (no == 1) {
cout << "No\n";
break;
}
nwx++;
}
}
}
# | 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... |