Submission #1231787

#TimeUsernameProblemLanguageResultExecution timeMemory
1231787SolikhaTrampoline (info1cup20_trampoline)C++20
54 / 100
2095 ms17316 KiB
#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, set<int>> xy;
  for(int i = 0; i < n; i++){
    int a, b; cin >> a >> b;
    xy[a].insert(b);
  }

  auto ans = [&](int x, int y, int xx, int yy) -> bool{
    if(x == xx) return true;
    if(x > xx) return false;
    for(; x < xx; x++){
      if(xy[x].empty()) return false;
      auto it = xy[x].lower_bound(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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...