#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
bool can;
int R, C, T, N, x, y, a, b;
cin >> R >> C >> N;
vector<int> green[R];
while (N--) {
cin >> x >> y;
x--; y--;
green[x].push_back(y);
}
for (int i = 0; i < R; i++) sort(green[i].begin(), green[i].end());
cin >> T;
while (T--) {
can = 1;
cin >> x >> y >> a >> b;
x--; y--; a--; b--;
if (a < x || b < y) {
cout << "No\n";
continue;
}
for (; x < a; x++) {
auto it = lower_bound(green[x].begin(), green[x].end(), y);
if (it == green[x].end()) {
can = 0;
cout << "No\n";
break;
} else if ((y = *it) > b) {
can = 0;
cout << "No\n";
break;
}
}
if (can) {
cout << "Yes\n";
}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
344 KB |
200 token(s): yes count is 21, no count is 179 |
2 |
Correct |
2 ms |
344 KB |
200 token(s): yes count is 70, no count is 130 |
3 |
Correct |
2 ms |
348 KB |
197 token(s): yes count is 25, no count is 172 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
41 ms |
2132 KB |
4000 token(s): yes count is 99, no count is 3901 |
2 |
Correct |
34 ms |
1884 KB |
4000 token(s): yes count is 91, no count is 3909 |
3 |
Correct |
64 ms |
1628 KB |
4000 token(s): yes count is 4000, no count is 0 |
4 |
Correct |
62 ms |
1916 KB |
4000 token(s): yes count is 1991, no count is 2009 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
554 ms |
1048576 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
540 ms |
1048576 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
522 ms |
1048576 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |