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 pb push_back
#define mp make_pair
#define mt make_tuple
using namespace std;
void solve(){
ll r,c,n;
cin >> r >> c >> n;
vector<vector<ll> > down(r);
while(n--){
ll x,y; cin >> x >> y; x--; y--;
down[x].pb(y);
}
for( int i = 0; i < r; i++ ){
sort( down[i].begin(), down[i].end() );
}
ll t;
cin >> t;
while(t--){
ll x1,y1,x2,y2; cin >> x1 >> y1 >> x2 >> y2; x1--; y1--; x2--; y2--;
if( x1 > x2 ){ cout << "No" << endl; continue; }
bool yes = true;
for( int i = x1; i < x2; i++ ){
auto it = lower_bound( down[i].begin(), down[i].end(), y1 );
if( it == down[i].end() ){ yes = false; break; }
y1 = *it;
if( y1 > y2 ){ yes = false; break; }
}
cout << ( yes ? "Yes" : "No") << endl;
}
return;
}
int main(){
//freopen( "input.txt", "r", stdin );
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
int t = 1; //cin>>t;
while(t--){ solve(); }
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... |