#include "bits/stdc++.h"
using namespace std;
#define int long long
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define ss second
#define ff first
#define pb push_back
void solve(){
int r, c, n; cin >> r >> c >> n;
map<int, vector<int>> xy;
for(int i = 0; i < n; i++){
int a, b; cin >> a >> b;
xy[a].pb(b);
}
auto ans = [&](int x, int y, int xx, int yy) -> bool{
if(x > xx || y > yy) return false;
if(x == xx) return true;
for(; x < xx; x++){
if(xy[x].empty()) return false;
auto it = lower_bound(all(xy[x]), y);
if(it == xy[x].end()) return false;
if(*it > yy) return false;
y = *it;
}
return true;
};
int t; cin >> t;
while(t--){
int x, y, xx, yy; cin >> x >> y >> xx >> yy;
cout << (ans(x, y, xx, yy) ? "Yes" : "No") << endl;
}
}
signed main() {
cin.tie(nullptr)->sync_with_stdio(false);
int t = 1; //cin >> t;
while(t--){
solve();
cout << endl;
}
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... |