We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 7b6cc7c commit 0306ab1Copy full SHA for 0306ab1
1 file changed
khj20006/202512/03 BOJ G4 감시 카메라.md
@@ -0,0 +1,41 @@
1
+```cpp
2
+#include <bits/stdc++.h>
3
+using namespace std;
4
+
5
+int N;
6
+map<int, set<int>> X, Y;
7
8
+int main() {
9
+ cin.tie(0)->sync_with_stdio(0);
10
11
+ cin >> N;
12
+ for (int i = 0, x, y; i < N; i++) {
13
+ cin >> x >> y;
14
+ X[x].insert(y);
15
+ Y[y].insert(x);
16
+ }
17
18
+ if (min(X.size(), Y.size()) <= 3) return cout << 1, 0;
19
20
+ for (auto [x, v] : X) {
21
+ for (int i : v) {
22
+ Y[i].erase(x);
23
+ if (Y[i].empty()) Y.erase(i);
24
25
+ if (Y.size() <= 2) return cout << 1, 0;
26
+ for (int i : v) Y[i].insert(x);
27
28
29
+ for (auto [y, v] : Y) {
30
31
+ X[i].erase(y);
32
+ if (X[i].empty()) X.erase(i);
33
34
+ if (X.size() <= 2) return cout << 1, 0;
35
+ for (int i : v) X[i].insert(y);
36
37
38
+ cout << 0;
39
40
+}
41
+```
0 commit comments