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"); + + } + +} + +```