제출 #1340144

#제출 시각아이디문제언어결과실행 시간메모리
1340144rahidilbayramliTrampoline (info1cup20_trampoline)C++20
0 / 100
576 ms1114112 KiB
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define ll long long
#define ld long double
#define vl vector<ll>
#define vi vector<int>
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define pb push_back
#define sz(v) (ll)(v.size())
#define f first
#define s second
#define pii pair<int, int>
#define pll pair<ll, ll>
using namespace std;
using namespace __gnu_pbds;
typedef tree<ll, null_type, less_equal<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
void solve()
{
    ll r, c, n, i, j;
    cin >> r >> c >> n;
    vl g[r+5];
    for(i = 1; i <= n; i++)
    {
        ll a, b;
        cin >> a >> b;
        g[a].pb(b);
    }
    for(i = 1; i <= r; i++)
        sort(all(g[i]));
    ll t;
    cin >> t;
    while(t--)
    {
        ll xs, ys, xp, yp;
        cin >> xs >> ys >> xp >> yp;
        if(xp < xs || yp < ys)
        {
            cout << "No\n";
            continue;
        }
        if(xs == xp)
        {
            cout << "Yes\n";
            continue;
        }
        bool fl = true;
        while(xs < xp)
        {
            if(!sz(g[xs]) || g[xs].back() < ys)
            {
                fl = false;
                break;
            }
            ll f = lower_bound(all(g[xs]), ys) - g[xs].begin();
            ys = g[xs][f];
            xs++;
        }
        if(fl)
            cout << "Yes\n";
        else
            cout << "No\n";
    }
}
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll tests = 1;
    //cin >> tests;
    while(tests--)
    {
        solve();
    }
}
#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...