/**
* In the name of Allah
* We are nothing and you're everything
* author: najmuddin
**/
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
using namespace std;
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
#define int ll
const char nl = '\n';
const int N = 2e5+5;
//const int inf = 1e18;
const int mod = 1e9+7;
void solve() {
int r, c, n; cin >> r >> c >> n;
map<int, multiset<int>> g;
for (int i = 0; i < n; ++i) {
int x, y; cin >> x >> y;
g[x].insert(y);
}
int q; cin >> q;
while (q--) {
int xs, ys, xe, ye;
cin >> xs >> ys >> xe >> ye;
if (xs == xe) {
if (ys <= ye)cout << "Yes" << nl;
else cout << "No" << nl;
continue;
}
if (xs > xe) {
cout << "No" << nl;
continue;
}
//bool ok = true;
while (xs != xe) {
if (g[xs].empty())break;
auto lb = g[xs].lower_bound(ys);
if (lb == g[xs].end() || *lb > ye)break;
ys = *lb; xs += 1;
}
//cout << xs << ' ' << ys << nl;
if (xs == xe && ys <= ye)cout << "Yes" << nl;
else cout << "No" << nl;
}
}
int32_t main() {
ios::sync_with_stdio(0);
cin.tie(0);
int 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... |