Submission #520734

#TimeUsernameProblemLanguageResultExecution timeMemory
520734QuantumK9Trampoline (info1cup20_trampoline)C++17
43 / 100
102 ms4984 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...