제출 #1144921

#제출 시각아이디문제언어결과실행 시간메모리
1144921tkm_algorithmsTrampoline (info1cup20_trampoline)C++20
0 / 100
498 ms1114112 KiB
/**
*    In the name of Allah
*    We are nothing and you're everything
*    author: najmuddin
**/
 
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
using namespace std;
	
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
#define int ll
 
const char nl = '\n';
const int N = 2e5+5;
//const int inf = 1e18;
const int mod = 1e9+7;

void solve() {
	int r, c, n; cin >> r >> c >> n;
	
	vector<int> g[r+1];
	for (int i = 0; i < n; ++i) {
		int x, y; cin >> x >> y;
		g[x].push_back(y);
	}
	
	int q; cin >> q;
	while (q--) {
		int xs, ys, xe, ye;
		cin >> xs >> ys >> xe >> ye;
		
		if (xs == xe) {
			if (ys <= ye)cout << "Yes" << nl;
			else cout << "No" << nl;
			continue;
		}
		
		if (xs > xe) {
			cout << "No" << nl;
			continue;
		}
		
		//bool ok = true;
		while (xs != xe) {
			if (g[xs].empty())break;
			int lb = lower_bound(all(g[xs]), ys) - g[xs].begin();
			if (ys > ye)break;
			if (lb == sz(g[xs]))break;
			ys = g[xs][lb]; xs += 1;
		}
		if (xs == xe && ys <= ye)cout << "Yes" << nl;
		else cout << "No" << nl;
	}
}	
 
int32_t main() {
    ios::sync_with_stdio(0);
    cin.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...