This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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;
unordered_map<int, vector<int>> green;
while (N--) {
cin >> x >> y;
x--; y--;
green[x].push_back(y);
}
for (pair<int, vector<int>> row: green) {
sort(row.second.begin(), row.second.end());
}
// 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 |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |