#include <bits/stdc++.h>
#include <ext/rope>
using namespace std;
using namespace __gnu_cxx;
#pragma GCC optimize("-Ofast")
#pragma GCC optimize("-O1")
//-------------------------------------------------------------//
typedef long long ll;
typedef unsigned long long ull;
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define PI acos(-1)
#define lb lower_bound
#define ub upper_bound
#define endl '\n'
#define all(v) v.begin(),v.end()
#define allr(v) v.rbegin(),v.rend()
#define sum_to(n) (n*(n+1))/2
#define pb push_back
#define pf push_front
#define sz size()
#define fil(arr,x) memset(arr,x,sizeof(arr))
const ll mod=1e9+7;
int dx[8]={0,1,0,-1,1,1,-1,-1};
int dy[8]={1,0,-1,0,1,-1,-1,1};
//-------------------------------------------------------------//
ll lcm(ll a,ll b)
{
return (max(a,b)/__gcd(a,b))*min(a,b);
}
void person_bool(bool x)
{
cout<<(x?"YES":"NO")<<endl;
}
int main()
{
//freopen("input.txt","r",stdin);
//freopen("output.txt","w",stdout);
fast
int r,c,n;
cin>>r>>c>>n;
vector<vector<int>>arr(r+1);
for(int i=0;i<n;i++){
int x,y;
cin>>x>>y;
arr[x].pb(y);
}
for(int i=1;i<=r;i++){
sort(all(arr[i]));
}
int q;cin>>q;
while(q--){
int x,y,a,b;
cin>>x>>y>>a>>b;
if(a<x || b<y || a-x>n){
cout<<"No"<<endl;
}
else{
int p=y;
bool valid=1;
for(int i=x;i<a;i++){
int j=lb(all(arr[i]),p)-arr[i].begin();
if(j==arr[i].sz){
valid=0;
break;
}
else{
p=arr[i][j];
}
}
cout<<(valid?"Yes":"No")<<endl;
}
}
return 0;
}
Compilation message
trampoline.cpp: In function 'int main()':
trampoline.cpp:63:12: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
63 | if(j==arr[i].sz){
| ^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
468 KB |
expected NO, found YES [2nd token] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
55 ms |
3528 KB |
expected NO, found YES [121st token] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2 ms |
588 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2 ms |
584 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2 ms |
596 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |