#include <bits/stdc++.h>
using namespace std;
#define Baytoro_MayrambekovOrz void solve()
#define ios ios::sync_with_stdio(false); cin.tie(NULL);
#define pb push_back
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define fr first
#define sc second
#define int long long
#define endl '\n'
vector<int> vec[100005];
int a,b,c,n,m,r,i,j,k,x,y,cnt=0,sum=0,res=0;
Baytoro_MayrambekovOrz{
cin>>r>>c>>n;
for(i=0;i<n;i++){
cin>>a>>b;
vec[a].pb(b);
}
for(i=0;i<100000;i++){
vec[i].pb(1e9);
sort(all(vec[i]));
}
//sort(all(vec));
int q;
cin>>q;
while(q--){
int x1,x2,y1,y2;
cin>>y1>>x1>>y2>>x2;
if(x2<x1 || y2<y1){
cout<<"No\n";
continue;
}
if(y1==y2){
cout<<"Yes\n";
continue;
}
int posy=y1,posx=x1;
while(posy<y2){
posx=*lower_bound(all(vec[posy]),posx);
//cout<<posx<<' '<<posy<<endl;
if(posx>x2){
cout<<"No\n";
break;
}
posy++;
}
if(posx<=x2 && posy==y2)
cout<<"Yes\n";
}
}
main(){
ios;
int T=1;
//cin>>T;
while(T--){
solve();
}
}
Compilation message
trampoline.cpp:54:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
54 | main(){
| ^~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
5836 KB |
200 token(s): yes count is 21, no count is 179 |
2 |
Correct |
11 ms |
5868 KB |
200 token(s): yes count is 70, no count is 130 |
3 |
Correct |
11 ms |
5868 KB |
197 token(s): yes count is 25, no count is 172 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
52 ms |
8232 KB |
4000 token(s): yes count is 99, no count is 3901 |
2 |
Correct |
50 ms |
9984 KB |
4000 token(s): yes count is 91, no count is 3909 |
3 |
Correct |
80 ms |
9352 KB |
4000 token(s): yes count is 4000, no count is 0 |
4 |
Correct |
89 ms |
10052 KB |
4000 token(s): yes count is 1991, no count is 2009 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
4 ms |
5196 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
3 ms |
5196 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
6 ms |
5152 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |