From ff5e8bfc6aa60816cdf944f8a08e864d5326588a Mon Sep 17 00:00:00 2001 From: Ukj0ng <90972240+Ukj0ng@users.noreply.github.com> Date: Mon, 29 Dec 2025 12:22:28 +0900 Subject: [PATCH] =?UTF-8?q?[20251229]=20BOJ=20/=20G3=20/=20=EA=B3=A0?= =?UTF-8?q?=EA=B8=B0=EC=9E=A1=EC=9D=B4=20/=20=ED=95=9C=EC=A2=85=EC=9A=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...40\352\270\260\354\236\241\354\235\264.md" | 83 +++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 "Ukj0ng/202512/29 BOJ G3 \352\263\240\352\270\260\354\236\241\354\235\264.md" diff --git "a/Ukj0ng/202512/29 BOJ G3 \352\263\240\352\270\260\354\236\241\354\235\264.md" "b/Ukj0ng/202512/29 BOJ G3 \352\263\240\352\270\260\354\236\241\354\235\264.md" new file mode 100644 index 00000000..fc1f987a --- /dev/null +++ "b/Ukj0ng/202512/29 BOJ G3 \352\263\240\352\270\260\354\236\241\354\235\264.md" @@ -0,0 +1,83 @@ +``` +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 final int[] dx = {1, 1, -1, -1}; + private static final int[] dy = {1, -1, 1, -1}; + private static List nets, fishes; + private static boolean[][] map; + private static int N, I, M, answer; + + public static void main(String[] args) throws IOException { + init(); + + for (int[] pos : fishes){ + for (int[] net : nets) { + for (int i = pos[0]-net[0]; i <= pos[0]+net[0]; i++) { + int count = 0; + for (int[] fish : fishes) { + if (i <= fish[0] && fish[0] <= i+net[0] && pos[1] <= fish[1] && fish[1] <= pos[1]+net[1]) count++; + } + answer = Math.max(answer, count); + } + + for (int i = pos[1]-net[1]; i <= pos[1]+net[1]; i++) { + int count = 0; + for (int[] fish : fishes) { + if (i <= fish[1] && fish[1] <= i+net[1] && pos[0] <= fish[0] && fish[0] <= pos[0]+net[0]) count++; + } + answer = Math.max(answer, count); + } + } + } + + 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()); + I = Integer.parseInt(st.nextToken()); + M = Integer.parseInt(st.nextToken()); + + map = new boolean[N+1][N+1]; + fishes = new ArrayList<>(); + + for (int i = 0; i < M; i++) { + st = new StringTokenizer(br.readLine()); + int x = Integer.parseInt(st.nextToken()); + int y = Integer.parseInt(st.nextToken()); + + map[x][y] = true; + fishes.add(new int[]{x, y}); + } + + nets = makeNet(); + } + + private static List makeNet() { + List nets = new ArrayList<>(); + + int r = 1; + int c = I/2-1; + + while (c > 0) { + nets.add(new int[]{r, c}); + r++; + c--; + } + + return nets; + } + + private static boolean OOB(int x, int y) { + return x < 1 || x > N || y < 1 || y > N; + } +} +```