#include <bits/stdc++.h>
using namespace std;
#define int long long
vector<int>arr[2505];
signed main(){
ios::sync_with_stdio(0); cin.tie(0);
int r,c,n; cin>>r>>c>>n;
for(int i=0; i<n; i++){
int a,b; cin>>a>>b;
arr[a].push_back(b); //row a has a green tramp at b
}
for(int i=0; i<2505; i++) sort(arr[i].begin(), arr[i].end());
int t; cin>>t;
while(t--){
int x1,y1,x2,y2; cin>>x1>>y1>>x2>>y2;
if(x2<x1) {cout<<"No\n"; continue;}
int row=x1, col=y1;
bool f=0;
while(row!=x2){
auto it = lower_bound(arr[row].begin(), arr[row].end(), col);
if(it==arr[row].end()){f=1; cout<<"No\n"; break;}
col = *it;
row++;
}
if(f) continue;
if(y2<col) cout<<"No\n";
else cout<<"Yes\n";
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
604 KB |
200 token(s): yes count is 21, no count is 179 |
2 |
Correct |
2 ms |
604 KB |
200 token(s): yes count is 70, no count is 130 |
3 |
Correct |
1 ms |
600 KB |
197 token(s): yes count is 25, no count is 172 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
38 ms |
4956 KB |
4000 token(s): yes count is 99, no count is 3901 |
2 |
Correct |
38 ms |
4980 KB |
4000 token(s): yes count is 91, no count is 3909 |
3 |
Correct |
66 ms |
4324 KB |
4000 token(s): yes count is 4000, no count is 0 |
4 |
Correct |
75 ms |
5152 KB |
4000 token(s): yes count is 1991, no count is 2009 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
600 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
604 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
600 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |