#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<queue>
#include<map>
#include<set>
using namespace std;
using ll = long long;
ll mod = 998244353;
void solve()
{
ll r, c, n; cin >> r >> c >> n;
map <ll,vector<ll>> mp;
for (ll i = 0; i < n; i++) {
ll a, b; cin >> a >> b;
--a, --b;
mp[a].push_back(b);
}
ll q; cin >> q;
while (q--) {
ll x1, y1, x2, y2;
cin >> x1 >> y1 >> x2 >> y2;
--x1, --x2, --y1, --y2;
/* if (x1 > x2 || y1 > y2) {
cout << "NO" << endl;
continue;
}*/
auto ind = lower_bound(mp[x1].begin(), mp[x1].end(), y1);
if (ind == mp[x1].end()) {
cout << "NO" << endl;
}
else if (*ind <= y2) {
cout << "YES" << endl;
}
else cout << "NO" << endl;
}
}
signed main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
//signed _; cin >> _; while (_--)
solve();
}
# | 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... |