#include <iostream>
#include <vector>
#include <cmath>
#include <set>
using namespace std;
#define pii pair<int, int>
vector<vector<int>>vec;
vector<bool>visit;
void dfs(int v) {
visit[v] = true;
for (auto u:vec[v]) {
if (!visit[u])
dfs(u);
}
}
int main() {
int r, c, n;
cin >> r >> c >> n;
set<pii>green;
set<int>green1;
int a, b;
for (int i = 0; i < n; i++) {
cin >> a >> b;
a--, b--;
green.insert({ a,b });
green1.insert(a * c + b);
}
int t;
cin >> t;
while (t--) {
int y1, x1, y2, x2;
cin >> y1 >> x1 >> y2 >> x2;
y1--, x1--, y2--, x2--;
auto it = green1.lower_bound(y1 * c + x1);
if (it == green1.end())
cout << "NO";
else {
if (*it <= y1 * c + x2)
cout << "YES";
else
cout << "NO";
}
cout << endl;
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
9 ms |
1040 KB |
expected NO, found YES [2nd token] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
333 ms |
19008 KB |
expected NO, found YES [1st token] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1222 ms |
19836 KB |
expected NO, found YES [65th token] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
25 ms |
716 KB |
expected NO, found YES [17th token] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1269 ms |
19772 KB |
expected NO, found YES [12th token] |
2 |
Halted |
0 ms |
0 KB |
- |