This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using namespace std;
#define lalala ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long
#define int long long int
//#define endl '\n'
#define N 600100
#define M 32
#define big 2147483647
#define bigg 9223372036854775807
#define pb push_back
#define p push
#define ins insert
#define f first
#define s second
vector<int> adj[N];
void solve(){
int r,c,n;cin>>r>>c>>n;
vector<pair<int,int>> v;
vector<int> yedek,comprez;
for(int i=0;i<n;i++){
int a,b;cin>>a>>b;
v.pb({b,a});
yedek.pb(a);yedek.pb(b);
}
sort(v.begin(),v.end());
sort(yedek.begin(),yedek.end());
comprez.pb(yedek[0]);
for(int i=1;i<n*2;i++){
if(yedek[i]!=yedek[i-1])comprez.pb(yedek[i]);
}
for(auto u:v){
int yer=u.s;
int kim=lower_bound(comprez.begin(),comprez.end(),yer)-comprez.begin();
adj[kim].clear();
}
for(auto u:v){
int yer=u.s;
int kim=lower_bound(comprez.begin(),comprez.end(),yer)-comprez.begin();
adj[kim].pb(u.f);
}
/*for(auto u:v){
int yer=u.s;
int kim=upper_bound(comprez.begin(),comprez.end(),yer)-comprez.begin();
kim--;
cout<<kim<<": ";
for(auto u:adj[kim])cout<<u<<" ";
cout<<endl;
}*/
int q;cin>>q;
while(q--){
int x,y,a,b;cin>>x>>a>>y>>b;
int kim=(lower_bound(comprez.begin(),comprez.end(),x)-comprez.begin());
if(kim==comprez.size()||comprez[kim]!=x){
cout<<"No"<<endl;
continue;
}
int yer=(lower_bound(adj[kim].begin(),adj[kim].end(),y)-adj[kim].begin());
if(yer==adj[kim].size()){
cout<<"No"<<endl;
continue;
}
int yey=adj[kim][yer];
if(yey>b)cout<<"No"<<endl;
else cout<<"Yes"<<endl;
}
}
signed main(){
lalala;
solve();
}
Compilation message (stderr)
trampoline.cpp: In function 'void solve()':
trampoline.cpp:55:9: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
55 | if(kim==comprez.size()||comprez[kim]!=x){
| ~~~^~~~~~~~~~~~~~~~
trampoline.cpp:60:9: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
60 | if(yer==adj[kim].size()){
| ~~~^~~~~~~~~~~~~~~~~
# | 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... |