From f8a797d536d3b1c974e76c855e93c2a739e1f227 Mon Sep 17 00:00:00 2001 From: oncsr Date: Mon, 21 Apr 2025 14:24:57 +0900 Subject: [PATCH 1/9] =?UTF-8?q?Create=20=EA=B6=8C=ED=98=81=EC=A4=80=5F14?= =?UTF-8?q?=EC=A3=BC=EC=B0=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...2\266\214\355\230\201\354\244\200_14\354\243\274\354\260\250" | 1 + 1 file changed, 1 insertion(+) create mode 100644 "\352\266\214\355\230\201\354\244\200_14\354\243\274\354\260\250" diff --git "a/\352\266\214\355\230\201\354\244\200_14\354\243\274\354\260\250" "b/\352\266\214\355\230\201\354\244\200_14\354\243\274\354\260\250" new file mode 100644 index 00000000..8b137891 --- /dev/null +++ "b/\352\266\214\355\230\201\354\244\200_14\354\243\274\354\260\250" @@ -0,0 +1 @@ + From 0e158803ca4c4fad22f1ec00c6d05e45a4a6c60d Mon Sep 17 00:00:00 2001 From: oncsr Date: Mon, 21 Apr 2025 15:16:57 +0900 Subject: [PATCH 2/9] =?UTF-8?q?Delete=20=EA=B6=8C=ED=98=81=EC=A4=80=5F14?= =?UTF-8?q?=EC=A3=BC=EC=B0=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...2\266\214\355\230\201\354\244\200_14\354\243\274\354\260\250" | 1 - 1 file changed, 1 deletion(-) delete mode 100644 "\352\266\214\355\230\201\354\244\200_14\354\243\274\354\260\250" diff --git "a/\352\266\214\355\230\201\354\244\200_14\354\243\274\354\260\250" "b/\352\266\214\355\230\201\354\244\200_14\354\243\274\354\260\250" deleted file mode 100644 index 8b137891..00000000 --- "a/\352\266\214\355\230\201\354\244\200_14\354\243\274\354\260\250" +++ /dev/null @@ -1 +0,0 @@ - From 8b6ba80f8dd6829d8ab3be10183f9f202b0ef60c Mon Sep 17 00:00:00 2001 From: oncsr Date: Mon, 21 Apr 2025 15:17:38 +0900 Subject: [PATCH 3/9] =?UTF-8?q?[BOJ-1695]=20=ED=8C=B0=EB=A6=B0=EB=93=9C?= =?UTF-8?q?=EB=A1=AC=20=EB=A7=8C=EB=93=A4=EA=B8=B0.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...4 \353\247\214\353\223\244\352\270\260.md" | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 "\352\266\214\355\230\201\354\244\200_14\354\243\274\354\260\250/[BOJ-1695] \355\214\260\353\246\260\353\223\234\353\241\254 \353\247\214\353\223\244\352\270\260.md" diff --git "a/\352\266\214\355\230\201\354\244\200_14\354\243\274\354\260\250/[BOJ-1695] \355\214\260\353\246\260\353\223\234\353\241\254 \353\247\214\353\223\244\352\270\260.md" "b/\352\266\214\355\230\201\354\244\200_14\354\243\274\354\260\250/[BOJ-1695] \355\214\260\353\246\260\353\223\234\353\241\254 \353\247\214\353\223\244\352\270\260.md" new file mode 100644 index 00000000..84140e09 --- /dev/null +++ "b/\352\266\214\355\230\201\354\244\200_14\354\243\274\354\260\250/[BOJ-1695] \355\214\260\353\246\260\353\223\234\353\241\254 \353\247\214\353\223\244\352\270\260.md" @@ -0,0 +1,58 @@ +```java +import java.util.*; +import java.io.*; + +public 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 = new StringTokenizer(""); + + static void nextLine() throws Exception {st = new StringTokenizer(br.readLine());} + static String nextToken() throws Exception { + while(!st.hasMoreTokens()) nextLine(); + return st.nextToken(); + } + static int nextInt() throws Exception { return Integer.parseInt(nextToken()); } + static long nextLong() throws Exception { return Long.parseLong(nextToken()); } + static double nextDouble() throws Exception { return Double.parseDouble(nextToken()); } + static void bwEnd() throws Exception {bw.flush();bw.close();} + + // Additional field + + static int N; + static int[] A; + static int[][] dp; + + public static void main(String[] args) throws Exception { + + ready(); + solve(); + + bwEnd(); + + } + + static void ready() throws Exception{ + + N = nextInt(); + A = new int[N]; + for(int i=0;i Date: Mon, 21 Apr 2025 16:17:30 +0900 Subject: [PATCH 4/9] =?UTF-8?q?[BOJ-1493]=20=EB=B0=95=EC=8A=A4=20=EC=B1=84?= =?UTF-8?q?=EC=9A=B0=EA=B8=B0.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...4 \354\261\204\354\232\260\352\270\260.md" | 90 +++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 "\352\266\214\355\230\201\354\244\200_14\354\243\274\354\260\250/[BOJ-1493] \353\260\225\354\212\244 \354\261\204\354\232\260\352\270\260.md" diff --git "a/\352\266\214\355\230\201\354\244\200_14\354\243\274\354\260\250/[BOJ-1493] \353\260\225\354\212\244 \354\261\204\354\232\260\352\270\260.md" "b/\352\266\214\355\230\201\354\244\200_14\354\243\274\354\260\250/[BOJ-1493] \353\260\225\354\212\244 \354\261\204\354\232\260\352\270\260.md" new file mode 100644 index 00000000..30da2ff8 --- /dev/null +++ "b/\352\266\214\355\230\201\354\244\200_14\354\243\274\354\260\250/[BOJ-1493] \353\260\225\354\212\244 \354\261\204\354\232\260\352\270\260.md" @@ -0,0 +1,90 @@ +```java +import java.util.*; +import java.io.*; + +public 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 = new StringTokenizer(""); + + static void nextLine() throws Exception {st = new StringTokenizer(br.readLine());} + static String nextToken() throws Exception { + while(!st.hasMoreTokens()) nextLine(); + return st.nextToken(); + } + static int nextInt() throws Exception { return Integer.parseInt(nextToken()); } + static long nextLong() throws Exception { return Long.parseLong(nextToken()); } + static double nextDouble() throws Exception { return Double.parseDouble(nextToken()); } + static void bwEnd() throws Exception {bw.flush();bw.close();} + + // Additional field + + static long length, width, height; + static int N; + static long[] C; + static boolean impossible = false; + + public static void main(String[] args) throws Exception { + + ready(); + solve(); + + bwEnd(); + + } + + static void ready() throws Exception{ + + length = nextInt(); + width = nextInt(); + height = nextInt(); + N = nextInt(); + C = new long[20]; + for(int i=0;i=0;k--) { + long d = 1< Date: Mon, 21 Apr 2025 17:10:32 +0900 Subject: [PATCH 5/9] =?UTF-8?q?[BOJ-1114]=20=ED=86=B5=EB=82=98=EB=AC=B4=20?= =?UTF-8?q?=EC=9E=90=EB=A5=B4=EA=B8=B0.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...4 \354\236\220\353\245\264\352\270\260.md" | 98 +++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 "\352\266\214\355\230\201\354\244\200_14\354\243\274\354\260\250/[BOJ-1114] \355\206\265\353\202\230\353\254\264 \354\236\220\353\245\264\352\270\260.md" diff --git "a/\352\266\214\355\230\201\354\244\200_14\354\243\274\354\260\250/[BOJ-1114] \355\206\265\353\202\230\353\254\264 \354\236\220\353\245\264\352\270\260.md" "b/\352\266\214\355\230\201\354\244\200_14\354\243\274\354\260\250/[BOJ-1114] \355\206\265\353\202\230\353\254\264 \354\236\220\353\245\264\352\270\260.md" new file mode 100644 index 00000000..987800a9 --- /dev/null +++ "b/\352\266\214\355\230\201\354\244\200_14\354\243\274\354\260\250/[BOJ-1114] \355\206\265\353\202\230\353\254\264 \354\236\220\353\245\264\352\270\260.md" @@ -0,0 +1,98 @@ +```java +import java.util.*; +import java.io.*; + +public 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 = new StringTokenizer(""); + + static void nextLine() throws Exception {st = new StringTokenizer(br.readLine());} + static String nextToken() throws Exception { + while(!st.hasMoreTokens()) nextLine(); + return st.nextToken(); + } + static int nextInt() throws Exception { return Integer.parseInt(nextToken()); } + static long nextLong() throws Exception { return Long.parseLong(nextToken()); } + static double nextDouble() throws Exception { return Double.parseDouble(nextToken()); } + static void bwEnd() throws Exception {bw.flush();bw.close();} + + // Additional field + + static int L, K, C; + static int[] A; + + public static void main(String[] args) throws Exception { + + ready(); + solve(); + + bwEnd(); + + } + + static void ready() throws Exception{ + + L = nextInt(); + K = nextInt(); + C = nextInt(); + A = new int[K]; + for(int i=0;i>1; + for(int i=1;i m) { + max = Math.max(max, A[i-1]-prev); + prev = A[i-1]; + cnt++; + } + } + if(L - prev > m) { + max = Math.max(max, A[K-1]-prev); + prev = A[K-1]; + cnt++; + } + max = Math.max(max, L-prev); + if(cnt > C || max > m) s = m+1; + else e = m; + m = (s+e)>>1; + } + + int len = m; + + // i에서 처음 자르기 + for(int i=0;i len) { + max = Math.max(max, A[j-1]-prev); + prev = A[j-1]; + cnt++; + } + } + if(L - prev > len) { + max = Math.max(max, A[K-1]-prev); + prev = A[K-1]; + cnt++; + } + max = Math.max(max, L-prev); + if(cnt > C || max != len) continue; + bw.write(len + " " + A[i]); + return; + } + } + +} +``` From 81811520d25581f88628ef5e54ed8afcaaa3789f Mon Sep 17 00:00:00 2001 From: oncsr Date: Mon, 21 Apr 2025 17:30:23 +0900 Subject: [PATCH 6/9] =?UTF-8?q?[BOJ-16954]=20=EC=9B=80=EC=A7=81=EC=9D=B4?= =?UTF-8?q?=EB=8A=94=20=EB=AF=B8=EB=A1=9C=20=ED=83=88=EC=B6=9C.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...0\353\241\234 \355\203\210\354\266\234.md" | 78 +++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 "\352\266\214\355\230\201\354\244\200_14\354\243\274\354\260\250/[BOJ-16954] \354\233\200\354\247\201\354\235\264\353\212\224 \353\257\270\353\241\234 \355\203\210\354\266\234.md" diff --git "a/\352\266\214\355\230\201\354\244\200_14\354\243\274\354\260\250/[BOJ-16954] \354\233\200\354\247\201\354\235\264\353\212\224 \353\257\270\353\241\234 \355\203\210\354\266\234.md" "b/\352\266\214\355\230\201\354\244\200_14\354\243\274\354\260\250/[BOJ-16954] \354\233\200\354\247\201\354\235\264\353\212\224 \353\257\270\353\241\234 \355\203\210\354\266\234.md" new file mode 100644 index 00000000..19c39f90 --- /dev/null +++ "b/\352\266\214\355\230\201\354\244\200_14\354\243\274\354\260\250/[BOJ-16954] \354\233\200\354\247\201\354\235\264\353\212\224 \353\257\270\353\241\234 \355\203\210\354\266\234.md" @@ -0,0 +1,78 @@ +```java +import java.util.*; +import java.io.*; + +public 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 = new StringTokenizer(""); + + static void nextLine() throws Exception {st = new StringTokenizer(br.readLine());} + static String nextToken() throws Exception { + while(!st.hasMoreTokens()) nextLine(); + return st.nextToken(); + } + static int nextInt() throws Exception { return Integer.parseInt(nextToken()); } + static long nextLong() throws Exception { return Long.parseLong(nextToken()); } + static double nextDouble() throws Exception { return Double.parseDouble(nextToken()); } + static void bwEnd() throws Exception {bw.flush();bw.close();} + + // Additional field + + static int[] dx = {-1,-1,-1,0,0,0,1,1,1}; + static int[] dy = {-1,0,1,-1,0,1,-1,0,1}; + static char[][][] A; + + public static void main(String[] args) throws Exception { + + ready(); + solve(); + + bwEnd(); + + } + + static void ready() throws Exception{ + + char[] base = {'.','.','.','.','.','.','.','.'}; + char[][] org = new char[8][8]; + + for(int i=0;i<8;i++) org[i] = br.readLine().toCharArray(); + + A = new char[9][8][8]; + for(int t=0;t<9;t++) { + for(int i=0;i Q = new LinkedList<>(); + boolean[][][] vis = new boolean[8][8][9]; + Q.offer(new int[] {7,0,0}); + vis[7][0][0] = true; + while(!Q.isEmpty()) { + int[] now = Q.poll(); + int x = now[0], y = now[1], t = now[2]; + if(x==0 && y==7) { + bw.write("1"); + return; + } + for(int i=0;i<9;i++) { + int xx = x+dx[i], yy = y+dy[i], tt = Math.min(8, t+1); + if(xx<0 || xx>=8 || yy<0 || yy>=8) continue; + if(A[t][xx][yy]=='#' || A[tt][xx][yy]=='#' || vis[xx][yy][tt]) continue; + vis[xx][yy][tt] = true; + Q.offer(new int[] {xx,yy,tt}); + } + } + bw.write("0"); + + } + +} +``` From 3f796321d1639c52473c91767e844e53b5e11401 Mon Sep 17 00:00:00 2001 From: oncsr Date: Mon, 21 Apr 2025 17:44:34 +0900 Subject: [PATCH 7/9] =?UTF-8?q?[BOJ-12764]=20=EC=8B=B8=EC=A7=80=EB=B0=A9?= =?UTF-8?q?=EC=97=90=20=EA=B0=84=20=EC=A4=80=ED=95=98.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... \352\260\204 \354\244\200\355\225\230.md" | 75 +++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 "\352\266\214\355\230\201\354\244\200_14\354\243\274\354\260\250/[BOJ-12764] \354\213\270\354\247\200\353\260\251\354\227\220 \352\260\204 \354\244\200\355\225\230.md" diff --git "a/\352\266\214\355\230\201\354\244\200_14\354\243\274\354\260\250/[BOJ-12764] \354\213\270\354\247\200\353\260\251\354\227\220 \352\260\204 \354\244\200\355\225\230.md" "b/\352\266\214\355\230\201\354\244\200_14\354\243\274\354\260\250/[BOJ-12764] \354\213\270\354\247\200\353\260\251\354\227\220 \352\260\204 \354\244\200\355\225\230.md" new file mode 100644 index 00000000..a64211f5 --- /dev/null +++ "b/\352\266\214\355\230\201\354\244\200_14\354\243\274\354\260\250/[BOJ-12764] \354\213\270\354\247\200\353\260\251\354\227\220 \352\260\204 \354\244\200\355\225\230.md" @@ -0,0 +1,75 @@ +```java +import java.util.*; +import java.io.*; + +public 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 = new StringTokenizer(""); + + static void nextLine() throws Exception {st = new StringTokenizer(br.readLine());} + static String nextToken() throws Exception { + while(!st.hasMoreTokens()) nextLine(); + return st.nextToken(); + } + static int nextInt() throws Exception { return Integer.parseInt(nextToken()); } + static long nextLong() throws Exception { return Long.parseLong(nextToken()); } + static double nextDouble() throws Exception { return Double.parseDouble(nextToken()); } + static void bwEnd() throws Exception {bw.flush();bw.close();} + + // Additional field + + static int N; + static TreeSet S; + static int[][] info; + static int[] num, cnt; + static int max = 0; + + public static void main(String[] args) throws Exception { + + ready(); + solve(); + + bwEnd(); + + } + + static void ready() throws Exception{ + + N = nextInt(); + info = new int[N*2][2]; + for(int i=1;i<=N;i++) { + int p = nextInt(), q = nextInt(); + info[(i-1)*2] = new int[] {p,i}; + info[(i-1)*2+1] = new int[] {q,-i}; + } + S = new TreeSet<>(); + for(int i=1;i<=N;i++) S.add(i); + num = new int[N+1]; + cnt = new int[N+1]; + + } + + static void solve() throws Exception{ + + Arrays.sort(info, (a,b) -> a[0]-b[0]); + for(int[] e:info) { + int v = e[0], id = Math.abs(e[1]); + boolean out = e[1] < 0; + + if(out) S.add(num[id]); + else { + num[id] = S.pollFirst(); + max = Math.max(max, num[id]); + cnt[num[id]]++; + } + } + bw.write(max + "\n"); + for(int i=1;i<=max;i++) bw.write(cnt[i] + " "); + + } + +} +``` From e3782e9b106a3f954c034884b0e68f4f95e02b51 Mon Sep 17 00:00:00 2001 From: oncsr Date: Mon, 21 Apr 2025 17:58:43 +0900 Subject: [PATCH 8/9] =?UTF-8?q?[BOJ-1445]=20=EC=9D=BC=EC=9A=94=EC=9D=BC=20?= =?UTF-8?q?=EC=95=84=EC=B9=A8=EC=9D=98=20=EB=8D=B0=EC=9D=B4=ED=8A=B8.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...0 \353\215\260\354\235\264\355\212\270.md" | 101 ++++++++++++++++++ 1 file changed, 101 insertions(+) create mode 100644 "\352\266\214\355\230\201\354\244\200_14\354\243\274\354\260\250/[BOJ-1445] \354\235\274\354\232\224\354\235\274 \354\225\204\354\271\250\354\235\230 \353\215\260\354\235\264\355\212\270.md" diff --git "a/\352\266\214\355\230\201\354\244\200_14\354\243\274\354\260\250/[BOJ-1445] \354\235\274\354\232\224\354\235\274 \354\225\204\354\271\250\354\235\230 \353\215\260\354\235\264\355\212\270.md" "b/\352\266\214\355\230\201\354\244\200_14\354\243\274\354\260\250/[BOJ-1445] \354\235\274\354\232\224\354\235\274 \354\225\204\354\271\250\354\235\230 \353\215\260\354\235\264\355\212\270.md" new file mode 100644 index 00000000..aeb604a7 --- /dev/null +++ "b/\352\266\214\355\230\201\354\244\200_14\354\243\274\354\260\250/[BOJ-1445] \354\235\274\354\232\224\354\235\274 \354\225\204\354\271\250\354\235\230 \353\215\260\354\235\264\355\212\270.md" @@ -0,0 +1,101 @@ +```java +import java.util.*; +import java.io.*; + +public 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 = new StringTokenizer(""); + + static void nextLine() throws Exception {st = new StringTokenizer(br.readLine());} + static String nextToken() throws Exception { + while(!st.hasMoreTokens()) nextLine(); + return st.nextToken(); + } + static int nextInt() throws Exception { return Integer.parseInt(nextToken()); } + static long nextLong() throws Exception { return Long.parseLong(nextToken()); } + static double nextDouble() throws Exception { return Double.parseDouble(nextToken()); } + static void bwEnd() throws Exception {bw.flush();bw.close();} + + // Additional field + + static final int[] dx = {0,1,0,-1}; + static final int[] dy = {1,0,-1,0}; + + static int N, M; + static char[][] A; + static int[][] P; + static int sx = -1, sy = -1; + + public static void main(String[] args) throws Exception { + + ready(); + solve(); + + bwEnd(); + + } + + static void ready() throws Exception{ + + N = nextInt(); + M = nextInt(); + A = new char[N][]; + P = new int[N][M]; + for(int i=0;i Q = new PriorityQueue<>((a,b) -> a[0]==b[0] ? a[1]-b[1] : a[0]-b[0]); + int[][] D = new int[N][M]; + int[][] C = new int[N][M]; + for(int i=0;i=N || yy<0 || yy>=M) continue; + if(A[xx][yy] == 'F') { + bw.write(d + " "+ c); + return; + } + int dd = d + (A[xx][yy] == 'g' ? 1 : 0); + int cc = c + P[xx][yy]; + if(D[xx][yy] > dd || (D[xx][yy] == dd && C[xx][yy] > cc)) { + D[xx][yy] = dd; + C[xx][yy] = cc; + Q.offer(new int[] {dd,cc,xx,yy}); + } + } + } + + } + +} +``` From 00c05018979d6c44d191d15c0079ed8f989cffa3 Mon Sep 17 00:00:00 2001 From: oncsr Date: Tue, 22 Apr 2025 09:04:54 +0900 Subject: [PATCH 9/9] =?UTF-8?q?[BOJ-14391]=20=EC=A2=85=EC=9D=B4=20?= =?UTF-8?q?=EC=A1=B0=EA=B0=81.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...5\354\235\264 \354\241\260\352\260\201.md" | 100 ++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 "\352\266\214\355\230\201\354\244\200_14\354\243\274\354\260\250/[BOJ-14391] \354\242\205\354\235\264 \354\241\260\352\260\201.md" diff --git "a/\352\266\214\355\230\201\354\244\200_14\354\243\274\354\260\250/[BOJ-14391] \354\242\205\354\235\264 \354\241\260\352\260\201.md" "b/\352\266\214\355\230\201\354\244\200_14\354\243\274\354\260\250/[BOJ-14391] \354\242\205\354\235\264 \354\241\260\352\260\201.md" new file mode 100644 index 00000000..e29c0ea1 --- /dev/null +++ "b/\352\266\214\355\230\201\354\244\200_14\354\243\274\354\260\250/[BOJ-14391] \354\242\205\354\235\264 \354\241\260\352\260\201.md" @@ -0,0 +1,100 @@ +```java +import java.util.*; +import java.io.*; + +public 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 = new StringTokenizer(""); + + static void nextLine() throws Exception {st = new StringTokenizer(br.readLine());} + static String nextToken() throws Exception { + while(!st.hasMoreTokens()) nextLine(); + return st.nextToken(); + } + static int nextInt() throws Exception { return Integer.parseInt(nextToken()); } + static long nextLong() throws Exception { return Long.parseLong(nextToken()); } + static double nextDouble() throws Exception { return Double.parseDouble(nextToken()); } + static void bwEnd() throws Exception {bw.flush();bw.close();} + + // Additional field + + static int N, M; + static char[][] A; + // 가로 : 1, 세로 : 2 + static int[][] used; + static int ans = 0; + + public static void main(String[] args) throws Exception { + + ready(); + solve(); + + bwEnd(); + + } + + static void ready() throws Exception{ + + N = nextInt(); + M = nextInt(); + A = new char[N][M]; + for(int i=0;i0 && used[x][y-1] != 1)) { + String temp = ""; + int k = y; + for(;k0 && used[x-1][y] != 2)) { + String temp = ""; + int k = x; + for(;k