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;
int main(){
int r,c,n;
cin>>r>>c>>n;
map < pair <int,int> ,int> mp;
while(n--){
int x,y;
cin>>x>>y;
pair <int,int> p=make_pair(x,y);
mp[p]=1;
}
int t;
cin>>t;
while(t--){
int x1,y1,x2,y2;
cin>>x1>>y1>>x2>>y2;
string ans="";
if(x1>x2 or y1>y2){
ans="No";
}
int y=y1;
int cnt=0;
for(int i=x1;i<x2;i++){
bool c=false;
for(auto x : mp){
pair <int,int> p=x.first;
if(p.first==i && p.second>=y){
cnt++;
y=p.second;
c=true;
break;
}
}
if(c==false){
ans="No";
break;
}
}
if(ans!="No" && cnt==x2-x1 && y<=y2){
ans="Yes";
}
cout<<ans<<endl;
}
}
# | 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... |