Submission #365696

# Submission time Handle Problem Language Result Execution time Memory
365696 2021-02-12T08:26:17 Z amunduzbaev Trampoline (info1cup20_trampoline) C++14
0 / 100
548 ms 15596 KB
/** made by amunduzbaev **/
#include <bits/stdc++.h>
using namespace std;
 
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define ub upper_bound
#define lb lower_bound
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(),x.rend()
#define NeedForSpeed ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define int long long
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii; 
typedef pair<ll, ll> pll; 
typedef vector<ll> vll;
typedef vector<int> vii;
typedef vector<pll> vpll;
typedef vector<pii> vpii;
template<class T> bool umin(T& a, const T& b) {return a > b? a = b, true:false;}
template<class T> bool umax(T& a, const T& b) {return a < b? a = b, true:false;}

const int N = 2e5+5;
const int mod = 1e9+7;
const ll inf = 1e18;
const ld Pi = acos(-1);

#define MULTI 0

int n, m, k, ans, res, a[N]; 

void solve(int t_case){
	cin>>n>>m>>k;
	set<pii> mm;
	for(int i=0;i<k;i++){
		int x, y; cin>>x>>y;
		mm.insert({x, y});
	}
	int t; cin>>t;
	for(int i=0;i<t;i++){
		int x, y, x1, y1; cin>>x>>y>>x1>>y1;
		if(x == x1 && y <= y1){
			cout<<"Yes\n";
			continue;
		}
		if(x1 < x || y1 < y) continue;
		auto cur = mm.lb((pii)mp(x, y));
		if((*cur).ff != x){
			cout<<"No\n";
			continue;
		}
		while((*cur).ff < x1 && (*cur).ss < y1) {
			//cout<<(*cur).ff<<" "<<(*cur).ss<<"\n";
			auto tt = mm.ub((*cur));	
			if((*cur).ff +1 == (*tt).ff){
				cur = tt;
				tt--;
				if((*cur).ff == (*tt).ff && (*cur).ss - (*tt).ss == 1) cur = tt;
			}
			else break;
		}
		if((*cur).ff +1 <= x1 && (*cur).ss <= y1) cout<<"Yes\n";
		else cout<<"No\n";
	}
}

signed main(){
	NeedForSpeed
	if(!MULTI) {
		solve(1);
	} else {
		int t; cin>>t;
		for(int t_case = 1; t_case <= t; t_case++) solve(t_case);
	}
	return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 1004 KB expected NO, found YES [2nd token]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 185 ms 13804 KB expected NO, found YES [1st token]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 383 ms 15544 KB expected NO, found YES [2nd token]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 7 ms 1004 KB expected NO, found YES [2nd token]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 548 ms 15596 KB expected NO, found YES [12th token]
2 Halted 0 ms 0 KB -