This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimize("Ofast,unroll-loops")
#include "bits/stdc++.h"
using namespace std;
//~ #ifndef ONLINE_JUDGE
//~ #include "debug.h"
//~ #else
//~ #define debug(...)
//~ #define debugArr(...)
//~ #endif
#define int long long
#define all(x) x.begin(),x.end()
#define ff first
#define ss second
#define pb push_back
template<class T, class U> inline bool chmin(T& a, const U& b) { if (a > b) { a = b; return true; } return false; }
template<class T, class U> inline bool chmax(T& a, const U& b) { if (a < b) { a = b; return true; } return false; }
const int inf = 1e9;
const int mod = 1e9 + 7;
const int N = 1e5 + 5;
void solve() {
int r,c,n;
cin >> r >> c >> n;
int a[n],b[n];
vector<pair<int,int>> v;
for(int i = 0;i < n;i++) {
cin >> a[i] >> b[i];
v.pb({a[i],b[i]});
}
sort(all(v));
int q;
cin >> q;
while(q--) {
int xs,ys,xf,yf;
cin >> xs >> ys >> xf >> yf;
bool check = 0;
for(int i = 0;i < n;i++) {
if(xs == xf && yf >= ys) {
check = 1;
break;
}
if(v[i].ff == xs && v[i].ss >= ys) {
xs++;
ys = v[i].ss;
}
}
if(xs == xf && yf >= ys) {
check = 1;
}
if(check) {
cout << "Yes\n";
} else {
cout << "No\n";
}
}
}
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);cout.tie(nullptr);
int t = 1;
//~ cin >> t;
while(t--) {
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... |