#include <bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(0); cin.tie(0);
#define ff first
#define ss second
#define ll long long
using namespace std;
const int MAX=2505;
const ll INF=1e10;
map<int,vector<ll>>m;
ll imp(ll a,ll dif,ll c){
while(dif--){
auto it=lower_bound(m[a].begin(),m[a].end(),c);
if(it==m[a].end()){
c=INF;
return c;
}
c=*it;
a++;
}
return c;
}
void go(){
int n, r,c; cin>>r>>c>>n;
for(int i=0;i<n;i++){
int a,b; cin>>a>>b;
m[a].push_back(b);
}
for(auto &it:m){
sort(it.ss.begin(),it.ss.end());
}
int t; cin>>t;
while(t--){
ll a,b,e,d; cin>>a>>b>>e>>d;
if(a>e || b>d){
cout<<"No"<<endl;
continue;
}
ll dif=e-a;
ll nc=imp(a,dif,b);
if(nc<=d) cout<<"Yes"<<endl;
else cout<<"No"<<endl;
}
}
int main(){
fastio;
go();
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
468 KB |
200 token(s): yes count is 21, no count is 179 |
2 |
Correct |
3 ms |
436 KB |
200 token(s): yes count is 70, no count is 130 |
3 |
Correct |
2 ms |
340 KB |
197 token(s): yes count is 25, no count is 172 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
89 ms |
3316 KB |
4000 token(s): yes count is 99, no count is 3901 |
2 |
Correct |
90 ms |
3400 KB |
4000 token(s): yes count is 91, no count is 3909 |
3 |
Correct |
199 ms |
2664 KB |
4000 token(s): yes count is 4000, no count is 0 |
4 |
Correct |
456 ms |
3356 KB |
4000 token(s): yes count is 1991, no count is 2009 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
322 ms |
3156 KB |
200000 token(s): yes count is 110486, no count is 89514 |
2 |
Correct |
319 ms |
2928 KB |
200000 token(s): yes count is 114664, no count is 85336 |
3 |
Correct |
349 ms |
3112 KB |
200000 token(s): yes count is 86232, no count is 113768 |
4 |
Correct |
354 ms |
15452 KB |
200000 token(s): yes count is 94603, no count is 105397 |
5 |
Correct |
371 ms |
15404 KB |
200000 token(s): yes count is 94148, no count is 105852 |
6 |
Correct |
456 ms |
21248 KB |
200000 token(s): yes count is 97163, no count is 102837 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
9 ms |
340 KB |
5000 token(s): yes count is 3238, no count is 1762 |
2 |
Correct |
12 ms |
412 KB |
5000 token(s): yes count is 3837, no count is 1163 |
3 |
Correct |
10 ms |
884 KB |
5000 token(s): yes count is 4104, no count is 896 |
4 |
Correct |
9 ms |
396 KB |
5000 token(s): yes count is 3934, no count is 1066 |
5 |
Correct |
303 ms |
532 KB |
5000 token(s): yes count is 3384, no count is 1616 |
6 |
Correct |
11 ms |
396 KB |
5000 token(s): yes count is 3390, no count is 1610 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
2071 ms |
10060 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |