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;
void solve() {
int n, m, d;
cin >> n >> m >> d;
vector<int> p(n), q(n);
for (int i = 0; i < n; ++i) {
cin >> p[i] >> q[i];
}
vector<int> r(m), s(m);
for (int i = 0; i < m; ++i) {
cin >> r[i] >> s[i];
}
int ans = d * d;
for (int lx = 0; lx < d; ++lx) {
for (int ly = 0; ly < d; ++ly) {
for (int rx = lx + 1; rx <= lx + d; ++rx) {
for (int ry = ly + 1; ry <= ly + d; ++ry) {
bool check = true;
for (int i = 0; i < n; ++i) {
if (!(lx <= p[i] && p[i] < rx) && !(lx <= p[i] + d && p[i] + d < rx)) {
check = false;
}
if (!(ly <= q[i] && q[i] < ry) && !(ly <= q[i] + d && q[i] + d < ry)) {
check = false;
}
}
for (int i = 0; i < m; ++i) {
if (!(lx <= r[i] && r[i] < rx) && !(lx <= r[i] + d && r[i] + d < rx) && !(ly <= s[i] && s[i] < ry) && !(ly <= s[i] + d && s[i] + d < ry)) {
check = false;
}
}
if (check) {
ans = min(ans, (rx - lx) * (ry - ly));
}
}
}
}
}
cout << ans << '\n';
}
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int t = 1;
// cin >> t;
while (t--) {
solve();
}
return 0;
}
# | 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... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |