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>
#define ll long long
#define sz size()
#define pb push_back
#define all(x) x.begin() , x.end()
using namespace std;
int main()
{
int r , c , n ; cin >> r >>c >> n ;
map<int,vector<int> >mp;
vector<pair<int,int>> temp ;
for (int i = 0; i < n; i++)
{
int a, b ; cin >> a >> b;
temp.pb({a , b}) ;
}
sort(all(temp)) ;
for (int i = 0; i < n; i++)
{
mp[temp[i].first].pb(temp[i].second);
}
int t ; cin >> t;
for (int i = 0; i < t; i++)
{
vector<int> v ; bool ok= 0 ;
int sx , sy , ex , ey ; cin >> sx >> sy >> ex >> ey;
if(ex < sx || ey < sy || !mp.count(sx)) { cout<<"No\n"; continue; }
v.pb(sy);
for(int j = sx ; j < ex ; j ++ ){
if(mp.count(j) == 0) { ok = 1;break; }
auto itt = lower_bound(all(mp[j]) , sy) ;
if(itt==mp[j].end()) { v.pb(-1);ok=1; break ; }
v.pb(*itt) ;
sy = *itt ;
//cout<<sy<<" " ;
}
if(ey >= sy && ok == 0 )cout<<"Yes\n"; else cout<<"No\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... |