#include <bits/stdc++.h>
using namespace std;
typedef long long lo;
#define fi first
#define se second
#define endl "\n"
#define pb push_back
#define int long long
#define fio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define FOR for(int i=1;i<=n;i++)
#define mid ((start+end)/2)
#define ort ((bas+son)/2)
#define _ << " " <<
const lo inf = 1000000000;
const lo li = 500005;
const lo mod = 1000000007;
int n,m,a[li],k,flag,t,x[li],y[li],r,c,xs[li],xh[li],ys[li],yh[li];
int cev;
string s;
vector<int> v,vv[li];
int32_t main(void){
fio();
cin>>r>>c>>n;
FOR{
cin>>x[i]>>y[i];
v.pb(x[i]);
}
cin>>t;
for(int i=1;i<=t;i++){
cin>>xs[i]>>ys[i]>>xh[i]>>yh[i];
}
sort(v.begin(),v.end());
int sayac=0;
map<int,int> mpp;
for(int i=0;i<(int)v.size();i++){
if(i==0 || v[i]!=v[i-1]){
sayac++;
if(i && v[i]-1!=v[i-1])sayac++;
mpp[v[i]]=sayac;
}
}
for(int i=1;i<=n;i++){
vv[mpp[x[i]]].pb(y[i]);
}
for(int i=1;i<=sayac;i++)sort(vv[i].begin(),vv[i].end());
for(int i=1;i<=t;i++){
//~ if(xh[i]-xs[i]>n){cout<<"No\n";continue;}
while(xs[i]<xh[i]){
if(ys[i]>yh[i])break;
if(mpp.find(x[i])==mpp.end())break;
int at=mpp[x[i]];
int tut=lower_bound(vv[at].begin(),vv[at].end(),ys[i])-vv[at].begin();
if(tut==(int)vv[at].size())break;
ys[i]=vv[at][tut];
xs[i]++;
}
if(xs[i]!=xh[i] || ys[i]>yh[i]){cout<<"No\n";continue;}
cout<<"Yes\n";
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
7 ms |
25436 KB |
expected NO, found YES [2nd token] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
130 ms |
31832 KB |
expected NO, found YES [1st token] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
110 ms |
40404 KB |
expected YES, found NO [4th token] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
210 ms |
25180 KB |
expected YES, found NO [1st token] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2079 ms |
45384 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |