Submission #1190597

#TimeUsernameProblemLanguageResultExecution timeMemory
1190597DedibeatGarden (JOI23_garden)C++20
0 / 100
3093 ms4160 KiB
#include<bits/stdc++.h> using namespace std; using ll = long long; template<typename T, typename U> ostream &operator<<(ostream &os, const pair<T, U> &p) { return os << "(" << p.first << "," << p.second << ")"; } template<typename T> void print(T v) { for(auto x : v) cout << x << " "; cout << "\n"; } int main() { int n, m, d; cin >> n >> m >> d; vector<pair<int, int>> A(n), B(m); for(auto &[x, y] : A) { cin >> x >> y; } for(auto &[x, y] : B) { cin >> x >> y; } auto checkA = [&](int xl, int xr, int yl, int yr, int x, int y) { if((xl <= x && x <= xr) && (yl <= y && y <= yr)) return 1; else return 0; }; auto checkB = [&](int xl, int xr, int yl, int yr, int x, int y) { if((xl <= x && x <= xr) || (yl <= y && y <= yr)) return 1; else return 0; }; int ans = 1e9; for(int i = 0; i < d; i++) { for(int j = 0; j < d; j++) { for(int k = i; k < d; k++) { for(int s = j; s < d; s++) { int ok = 1; for(auto [x, y] : A) { if(!checkA(i, k, j, s, x, y)) ok = 0; } for(auto [x, y] : B) { if(!checkB(i, k, j, s, x, y)) ok = 0; } if(ok) ans = min(ans, (k - i + 1) * (s - j + 1)); } } } } cout << ans << "\n"; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...