제출 #914737

#제출 시각아이디문제언어결과실행 시간메모리
914737NValchanovTrampoline (info1cup20_trampoline)C++17
43 / 100
36 ms10620 KiB
#include<bits/stdc++.h>

#define endl '\n'

using namespace std;

typedef long long ll;

const ll MAXN=2e5+10;
const ll MAXR=1e9+10;
const ll MAXC=1e9+10;
const ll MAXT=2e5+10;

ll r,c,n,t;
bool a[3000][3000];

bool check(ll x1,ll y1,ll x2,ll y2)
{
    return x1<=x2&&y1<=y2;
}

void query(ll x1,ll y1,ll x2,ll y2)
{
    if(!check(x1,y1,x2,y2))
    {
        cout<<"No"<<endl;
        return;
    }
    ll x=x1,y=y1;
    while(x<=r&&y<=c)
    {
        if(x==x2&&y==y2)
        {
            cout<<"Yes"<<endl;
            return;
        }
        if(a[x][y]&&x<x2)
            x++;
        else
            y++;
    }
    cout<<"No"<<endl;
}

void read()
{
    cin>>r>>c>>n;
    for(ll i=1;i<=n;i++)
    {
        ll x,y;
        cin>>x>>y;
        a[x][y]=true;
    }
    cin>>t;
    for(ll i=1;i<=t;i++)
    {
        ll x1,y1,x2,y2;
        cin>>x1>>y1>>x2>>y2;
        query(x1,y1,x2,y2);
    }
}

int main()
{
    #ifdef ONLINE_JUDGE
    freopen(".in", "r", stdin);
    freopen(".out", "w", stdout);
#endif
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);

    read();

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