This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#define wiwihorz
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("sse")
#pragma loop-opt(on)
#define rep(i, a, b) for(int i = a; i <= b; i ++)
#define rrep(i, a, b) for(int i = b; i >= a; i--)
#define ceil(a, b) ((a + b - 1) / (b))
#define all(x) x.begin(), x.end()
#define int long long int
#define lld long double
#define pii pair<int, int>
#define random mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count())
using namespace std;
#define INF 1000000000000000000
#define MOD 1000000007
#define eps (1e-9)
#ifdef wiwihorz
#define print(a...) cerr<<"Line "<<__LINE__<<":",kout("[" + string(#a) + "] = ", a)
void vprint(auto L, auto R) { while(L < R) cerr << *L << " \n"[next(L)==R], ++L;}
void kout() { cerr << endl; }
template<class T1, class ... T2> void kout(T1 a, T2 ... e) { cerr << a << " ", kout(e...);}
#else
#define print(...) 0
#define vprint(...) 0
#endif
namespace solver {
int r, c, n, ii;
vector<set<int>> s;
map<int, int> mp;
void init_(int _r, int _c, int _n) {
r = _r, c = _c;
n = _n, ii = 0;
s.assign(n + 1, set<int>());
mp.clear();
}
void solve() {
rep(i, 1, n) {
int x, y;
cin >> x >> y;
if(mp.find(x) == mp.end()) mp[x] = ++ii;
s[mp[x]].insert(y);
}
int t; cin >> t;
while(t--) {
int x, y, x1, y1;
cin >> x >> y;
cin >> x1 >> y1;
if(x > x1 || y > y1) cout << "No\n";
else if(x1 - x > n) cout << "No\n";
else {
int cur = y1, ans = 1;
rrep(i, x, x1 - 1) {
if(mp.find(i) == mp.end()) {
ans = 0;
break;
}
int id = mp[i];
auto it = s[id].upper_bound(cur);
if(it == s[id].begin()) {
ans = 0;
break;
}
it = prev(it);
cur = *it;
}
if(ans && cur >= y) cout << "Yes\n";
else cout << "No\n";
}
}
}
};
using namespace solver;
signed main() {
ios::sync_with_stdio(false), cin.tie(0);
int r, c, n;
cin >> r >> c >> n;
init_(r, c, n);
solve();
return 0;
}
Compilation message (stderr)
trampoline.cpp:5: warning: ignoring '#pragma loop ' [-Wunknown-pragmas]
5 | #pragma loop-opt(on)
|
trampoline.cpp:21:13: warning: use of 'auto' in parameter declaration only available with '-fconcepts-ts'
21 | void vprint(auto L, auto R) { while(L < R) cerr << *L << " \n"[next(L)==R], ++L;}
| ^~~~
trampoline.cpp:21:21: warning: use of 'auto' in parameter declaration only available with '-fconcepts-ts'
21 | void vprint(auto L, auto R) { while(L < R) cerr << *L << " \n"[next(L)==R], ++L;}
| ^~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |