From a9205aca2217b229dedd63fded294eb7096d396d Mon Sep 17 00:00:00 2001 From: Ukj0ng <90972240+Ukj0ng@users.noreply.github.com> Date: Fri, 22 Aug 2025 23:34:58 +0900 Subject: [PATCH] =?UTF-8?q?[20250822]=20BOJ=20/=20G3=20/=20=ED=95=98?= =?UTF-8?q?=EB=8A=98=EC=97=90=EC=84=9C=20=EB=B3=84=EB=98=A5=EB=B3=84?= =?UTF-8?q?=EC=9D=B4=20=EB=B9=97=EB=B0=9C=EC=B9=9C=EB=8B=A4=20/=20?= =?UTF-8?q?=ED=95=9C=EC=A2=85=EC=9A=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...4 \353\271\227\353\260\234\354\271\234.md" | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 "Ukj0ng/202508/22 BOJ G3 \355\225\230\353\212\230\354\227\220\354\204\234 \353\263\204\353\230\245\353\263\204\354\235\264 \353\271\227\353\260\234\354\271\234.md" diff --git "a/Ukj0ng/202508/22 BOJ G3 \355\225\230\353\212\230\354\227\220\354\204\234 \353\263\204\353\230\245\353\263\204\354\235\264 \353\271\227\353\260\234\354\271\234.md" "b/Ukj0ng/202508/22 BOJ G3 \355\225\230\353\212\230\354\227\220\354\204\234 \353\263\204\353\230\245\353\263\204\354\235\264 \353\271\227\353\260\234\354\271\234.md" new file mode 100644 index 00000000..bc76116c --- /dev/null +++ "b/Ukj0ng/202508/22 BOJ G3 \355\225\230\353\212\230\354\227\220\354\204\234 \353\263\204\353\230\245\353\263\204\354\235\264 \353\271\227\353\260\234\354\271\234.md" @@ -0,0 +1,60 @@ +``` +import java.io.*; +import java.util.*; + +public class Main { + private static final BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + private static final BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out)); + private static int[][] stars; + private static int N, M, L, K, answer; + + public static void main(String[] args) throws IOException { + init(); + + bw.write(answer + "\n"); + bw.flush(); + bw.close(); + br.close(); + } + + private static void init() throws IOException { + StringTokenizer st = new StringTokenizer(br.readLine()); + N = Integer.parseInt(st.nextToken()); + M = Integer.parseInt(st.nextToken()); + L = Integer.parseInt(st.nextToken()); + K = Integer.parseInt(st.nextToken()); + answer = K; + int max = 0; + + stars = new int[K][2]; + + Set xCandidates = new HashSet<>(); + Set yCandidates = new HashSet<>(); + + for (int i = 0; i < K; i++) { + st = new StringTokenizer(br.readLine()); + stars[i][0] = Integer.parseInt(st.nextToken()); + stars[i][1] = Integer.parseInt(st.nextToken()); + xCandidates.add(stars[i][0]); + yCandidates.add(stars[i][1]); + } + + for (int x : xCandidates) { + for (int y : yCandidates) { + int count = 0; + + for (int i = 0; i < K; i++) { + if (stars[i][0] >= x && stars[i][0] <= x + L && + stars[i][1] >= y && stars[i][1] <= y + L) { + count++; + } + } + + max = Math.max(max, count); + } + } + + answer -= max; + } +} +```