#include <bits/stdc++.h>
using namespace std;
void solve() {
int r, c;
cin >> r >> c;
int n;
cin >> n;
map <int, vector <int>> mp;
for(int i = 0; i < n; i ++) {
int a, b;
cin >> a >> b;
a --;
b --;
#define pb push_back
mp[a].pb(b);
}
int T;
cin >> T;
while(T --) {
pair <int, int> start, end;
cin >> start.first >> start.second >> end.first >> end.second;
start.first --;
start.second --;
end.first --;
end.second --;
int x1 = start.first;
int y1 = start.second;
int x2 = end.first;
int y2 = end.second;
while(x1 != x2) {
if(mp[x1].empty()) break;
auto temp = lower_bound(mp[x1].begin(), mp[x1].end(), y1);
if(temp == mp[x1].end()) break;
y1 = *temp; x1 ++;
}
if(x1 == x2 and y1 <= y2) cout << "Yes\n";
else cout << "No\n";
}
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int Q = 1;
//cin >> Q;
while (Q --) {
solve();
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
332 KB |
expected YES, found NO [1st token] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
57 ms |
2000 KB |
expected YES, found NO [3rd token] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
133 ms |
2140 KB |
expected YES, found NO [4th token] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
5 ms |
460 KB |
expected YES, found NO [1st token] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
739 ms |
9752 KB |
expected YES, found NO [1st token] |
2 |
Halted |
0 ms |
0 KB |
- |