This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#define int long long
vector<int>arr[2505];
pair<int,int>arr1[200005];
signed main(){
ios::sync_with_stdio(0); cin.tie(0);
int r,c,n; cin>>r>>c>>n;
/*if(r<=2500 and c<=2500){
for(int i=0; i<n; i++){
int a,b; cin>>a>>b;
arr[a].push_back(b); //row a has a green tramp at b
}
for(int i=0; i<2505; i++) sort(arr[i].begin(), arr[i].end());
int t; cin>>t;
while(t--){
int x1,y1,x2,y2; cin>>x1>>y1>>x2>>y2;
if(x2<x1) {cout<<"No\n"; continue;}
int row=x1, col=y1;
bool f=0;
while(row!=x2){
auto it = lower_bound(arr[row].begin(), arr[row].end(), col);
if(it==arr[row].end()){f=1; cout<<"No\n"; break;}
col = *it;
row++;
}
if(f) continue;
if(y2<col) cout<<"No\n";
else cout<<"Yes\n";
}
return 0;
} */
for(int i=0; i<n; i++) cin>>arr1[i].first>>arr1[i].second;
sort(arr1, arr1+n);
//for(int i=0;i<n; i++) cout<<arr1[i].first<<" "<<arr1[i].second<<"\n";
int t; cin>>t;
while(t--){
int x1,y1,x2,y2; cin>>x1>>y1>>x2>>y2;
int row=x1, col=y1;
bool f=0;
pair<int,int> p = {row,col};
while(row!=x2){
auto it = lower_bound(arr1, arr1+n, p);
if(it==arr1+n){cout<<"No\n"; f=1; break;}
p = *it;
if(p.first != row or p.second > y2){cout<<"No\n"; f=1; break;}
row++; p.first=row;
}
if(f) continue;
if(p.second>y2) cout<<"No\n";
else cout<<"Yes\n";
}
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... |