Submission #503999

#TimeUsernameProblemLanguageResultExecution timeMemory
503999bebecanvasTrampoline (info1cup20_trampoline)C++14
43 / 100
498 ms1048580 KiB
#include <bits/stdc++.h>

using namespace std;
#define int long long
#define endl '\n'


signed main(){

    ios_base::sync_with_stdio(false);
    cin.tie(0);
    
    int r, c, n; cin >> r >> c >> n;
    int g[r][c];
    for(int i=0; i<r; i++){
		for(int j=0; j<c; j++){
			g[i][j]= -1;
		}
	}

	for(int i=0; i<n; i++){
		int a, b; cin >> a >> b; a--; b--;
		g[a][b]= b;
	}
	
	for(int i=0; i<r; i++){
		for(int j=0; j<c; j++){
			if(j==0){continue;}
			if(g[i][j-1]>g[i][j]){g[i][j]= g[i][j-1];}
		}
	}
	
	int q; cin >> q;
	for(int i=0; i<q; i++){
		int a, b, c, d; cin >> a >> b >> c >> d;
		a--; b--; c--; d--;
		
		bool yea= true;
		if(a>c){yea= false;}
		while(c>a){
			if(g[c-1][d]==-1){yea= false; break;}
			d= g[c-1][d];
			c--;
			if(d<b){yea= false; break;}
		}
		
		if(yea){cout << "Yes" << endl;}
		else{cout << "No" << endl;}
	}
	

    
	
	

}

#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...