# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1144957 | KasymK | Trampoline (info1cup20_trampoline) | C++20 | 317 ms | 13212 KiB |
#include "bits/stdc++.h"
using namespace std;
#define ff first
#define ss second
#define all(v) v.begin(), v.end()
#define ll long long
#define pb push_back
#define pii pair<int, int>
#define pli pair<ll, int>
#define pll pair<ll, ll>
#define tr(i, c) for(auto i = c.begin(); i != c.end(); ++i)
#define wr puts("----------------")
template<class T>bool umin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T>bool umax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
const int N = 2e5+5;
vector<int> adj[N];
int main(){
int r, c, n;
scanf("%d%d%d", &r, &c, &n);
vector<int> v;
vector<pii> A;
map<int, int> mp;
for(int i = 0; i < n; ++i){
int a, b;
scanf("%d%d", &a, &b);
A.pb({a, b});
if(!mp.count(a))
mp[a]++, v.pb(a);
}
int op=-1;
sort(all(v));
tr(it, v)
mp[*it]=++op;
// tr(it, A)
// printf("%d %d\n", *it);
tr(it, A)
adj[mp[it->ff]].pb(it->ss);
for(auto i : mp)
sort(all(adj[i.ff]));
int q;
scanf("%d", &q);
while(q--){
int x, y, x1, y1;
scanf("%d%d%d%d", &x, &y, &x1, &y1);
if(x>x1 or y>y1){
puts("No");
continue;
}
while(x<x1){
if(!mp.count(x))
break;
if(adj[mp[x]].back()<y)
break;
int id=lower_bound(all(adj[mp[x]]), y)-adj[mp[x]].begin();
y=adj[mp[x]][id], x++;
}
puts(x==x1 and y<=y1?"Yes":"No");
}
return 0;
}
Compilation message (stderr)
# | 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... |