Submission #692301

#TimeUsernameProblemLanguageResultExecution timeMemory
692301NeroZeinTrampoline (info1cup20_trampoline)C++14
53 / 100
2056 ms28240 KiB
/*
 *    author: NeroZein
 *    created: 01.02.2023 13:03:54
*/
#include <bits/stdc++.h>
using namespace std;

#ifdef Nero
#include "Deb.h"
#else
#define deb(...)
#endif


signed main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int r, c, n;
	cin >> r >> c >> n;
	map<int, set<int>> se; 
	for (int i = 0; i < n; ++i) {
		int x, y;
		cin >> x >> y;
		se[x].insert(y); 
	}
	int q;
	cin >> q; 
	while(q--) {
		int xs, ys, xf, yf;
		cin >> xs >> ys >> xf >> yf; 
		while(yf > ys && xf > xs) {
			if (se[xf-1].empty()) {
				break; 
			}
			auto it = se[xf-1].upper_bound(yf);
			if (it == se[xf-1].begin()) { 
				break; 
			}
			--it; 
			yf = *it; 
			--xf; 
		}
		cout << (xf == xs && yf >= ys ? "YES" : "NO") << '\n';
	}
	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...