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;
typedef long long ll;
vector<ll>v[200001];
int main()
{
ll r , c , n , x , y , a, b, t;
cin >> r>> c >> n ;
//cout << r << " " << c << " " << n << "\n";
map<ll,ll>mp;
//cout << "haha\n";
ll cnt=1;
for(int i = 0 ; i < n ; i++)
{
cin >> x>> y ;
if(!mp[x])mp[x]=cnt++;
v[mp[x]].push_back(y);
}
for(int i =1 ;i < cnt ; i++)
{
sort(v[i].begin() , v[i].end());
}
cin >> t;
while(t--)
{
cin>> x >> y >> a >> b ;
if(x==a)
{
if(y<=b)
{
cout << "Yes\n";
}
else cout << "No\n";
continue;
}
int j=y;
int impos=1;
for(int i = x ; i<a ; i++)
{
if(mp[i]==0)
{
impos=1;
break;
}
vector<ll>::iterator it = lower_bound(v[mp[i]].begin() , v[mp[i]].end() , j);
if(it==v[mp[i]].end())
{
j=c+1;
}
else j=*it;
//cout << j << "\n";
if(j>b)
{
impos=1;
break;
}
if(i==a-1)
{
impos=0;
}
}
if(impos)
{
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... |