Submission #1145205

#TimeUsernameProblemLanguageResultExecution timeMemory
1145205thecrazycandyTrampoline (info1cup20_trampoline)C++20
43 / 100
832 ms548240 KiB
#include <bits/stdc++.h>
//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx,avx2,fma")
using namespace std;
#define sped_up ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
const ll INF = (ll)1e9 + 1, INFL = (ll)1e18 + 1;
const ll mod = (ll)1e9 + 7, MAXN = (ll)1e7 + 1;
int main() {
    ll n, m, k, q;
    cin >> n >> m >> k;
    vector <ll> g[MAXN];
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j < m; j++) {
            g[m * (i - 1) + j].push_back(m * (i - 1) + j + 1);
        }
    }
    for (int i = 1; i <= k; i++) {
        ll x, y;
        cin >> x >> y;
        g[m * (x - 1) + y].push_back(m * x + y);
    }
    cin >> q;
    for (int i = 1; i <= q; i++) {
		ll x1, y1, x2, y2;
		cin >> x1 >> y1 >> x2 >> y2;
		while (x1 < x2) {
		    if (g[(x1 - 1) * m + y1].size() >= 2) x1++;
		    else y1++;
		    if (y1 > y2) break;
		}
		if (x1 == x2 && y1 <= y2) cout << "Yes\n";
		else cout << "No\n";
    }
}
#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...