From 0306ab1ddb59ade96534f12ff7b8e0f9e29a16af Mon Sep 17 00:00:00 2001 From: oncsr Date: Wed, 3 Dec 2025 20:11:47 +0900 Subject: [PATCH] =?UTF-8?q?[20251203]=20BOJ=20/=20G4=20/=20=EA=B0=90?= =?UTF-8?q?=EC=8B=9C=20=EC=B9=B4=EB=A9=94=EB=9D=BC=20/=20=EA=B6=8C?= =?UTF-8?q?=ED=98=81=EC=A4=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...4 \354\271\264\353\251\224\353\235\274.md" | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 "khj20006/202512/03 BOJ G4 \352\260\220\354\213\234 \354\271\264\353\251\224\353\235\274.md" diff --git "a/khj20006/202512/03 BOJ G4 \352\260\220\354\213\234 \354\271\264\353\251\224\353\235\274.md" "b/khj20006/202512/03 BOJ G4 \352\260\220\354\213\234 \354\271\264\353\251\224\353\235\274.md" new file mode 100644 index 00000000..95b8425f --- /dev/null +++ "b/khj20006/202512/03 BOJ G4 \352\260\220\354\213\234 \354\271\264\353\251\224\353\235\274.md" @@ -0,0 +1,41 @@ +```cpp +#include +using namespace std; + +int N; +map> X, Y; + +int main() { + cin.tie(0)->sync_with_stdio(0); + + cin >> N; + for (int i = 0, x, y; i < N; i++) { + cin >> x >> y; + X[x].insert(y); + Y[y].insert(x); + } + + if (min(X.size(), Y.size()) <= 3) return cout << 1, 0; + + for (auto [x, v] : X) { + for (int i : v) { + Y[i].erase(x); + if (Y[i].empty()) Y.erase(i); + } + if (Y.size() <= 2) return cout << 1, 0; + for (int i : v) Y[i].insert(x); + } + + for (auto [y, v] : Y) { + for (int i : v) { + X[i].erase(y); + if (X[i].empty()) X.erase(i); + } + if (X.size() <= 2) return cout << 1, 0; + for (int i : v) X[i].insert(y); + } + + cout << 0; + +} +```