From 1898fddeb745dd412e4ea00483491393150d63d7 Mon Sep 17 00:00:00 2001 From: oncsr Date: Wed, 5 Mar 2025 15:29:15 +0900 Subject: [PATCH] =?UTF-8?q?[20250305]=20BOJ=20/=20G2=20/=20=EB=AA=A8?= =?UTF-8?q?=EB=9E=98=EC=84=B1=20/=20=EA=B6=8C=ED=98=81=EC=A4=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...2 \353\252\250\353\236\230\354\204\261.md" | 82 +++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 "khj20006/202503/05 BOJ G2 \353\252\250\353\236\230\354\204\261.md" diff --git "a/khj20006/202503/05 BOJ G2 \353\252\250\353\236\230\354\204\261.md" "b/khj20006/202503/05 BOJ G2 \353\252\250\353\236\230\354\204\261.md" new file mode 100644 index 00000000..e4ad5013 --- /dev/null +++ "b/khj20006/202503/05 BOJ G2 \353\252\250\353\236\230\354\204\261.md" @@ -0,0 +1,82 @@ +```java + +import java.util.*; +import java.io.*; + +class Main { + + // IO field + static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + static BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out)); + static StringTokenizer st; + + static void nextLine() throws Exception {st = new StringTokenizer(br.readLine());} + static int nextInt() {return Integer.parseInt(st.nextToken());} + static long nextLong() {return Long.parseLong(st.nextToken());} + static void bwEnd() throws Exception {bw.flush();bw.close();} + + // Additional field + + static int H, W; + static int[][] A; + static boolean[][] vis; + static int[] dx = {1,1,1,0,0,-1,-1,-1}; + static int[] dy = {1,0,-1,1,-1,1,0,-1}; + + public static void main(String[] args) throws Exception { + + ready(); + solve(); + + bwEnd(); + + } + + static void ready() throws Exception{ + + nextLine(); + H = nextInt(); + W = nextInt(); + A = new int[H][W]; + vis = new boolean[H][W]; + for(int i=0;i Q = new LinkedList<>(); + for(int i=0;i=H || yy<0 || yy>=W || vis[xx][yy]) continue; + if(--A[xx][yy] == 0) { + vis[xx][yy] = true; + Q.add(new int[] {xx,yy,time+1}); + } + } + } + + bw.write(ans + "\n"); + + } + +} + +```