#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
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()){
| ~~~^~~~~~~~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
6 ms |
14936 KB |
expected NO, found YES [7th token] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
92 ms |
23464 KB |
expected NO, found YES [1st token] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
340 ms |
25888 KB |
expected YES, found NO [4th token] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
11 ms |
14684 KB |
expected YES, found NO [1st token] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
362 ms |
27816 KB |
expected YES, found NO [1st token] |
2 |
Halted |
0 ms |
0 KB |
- |