From 80bbb541460f5b1374fbda75f52709d7a70376ac Mon Sep 17 00:00:00 2001 From: oncsr Date: Tue, 13 May 2025 18:28:05 +0900 Subject: [PATCH 1/4] =?UTF-8?q?[BOJ-12784]=20=EC=9D=B8=ED=95=98=EB=8B=88?= =?UTF-8?q?=EC=B9=B4=20=EA=B3=B5=ED=99=94=EA=B5=AD.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...4 \352\263\265\355\231\224\352\265\255.md" | 66 +++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 "\352\266\214\355\230\201\354\244\200_17\354\243\274\354\260\250/[BOJ-12784] \354\235\270\355\225\230\353\213\210\354\271\264 \352\263\265\355\231\224\352\265\255.md" diff --git "a/\352\266\214\355\230\201\354\244\200_17\354\243\274\354\260\250/[BOJ-12784] \354\235\270\355\225\230\353\213\210\354\271\264 \352\263\265\355\231\224\352\265\255.md" "b/\352\266\214\355\230\201\354\244\200_17\354\243\274\354\260\250/[BOJ-12784] \354\235\270\355\225\230\353\213\210\354\271\264 \352\263\265\355\231\224\352\265\255.md" new file mode 100644 index 00000000..9a0ddd84 --- /dev/null +++ "b/\352\266\214\355\230\201\354\244\200_17\354\243\274\354\260\250/[BOJ-12784] \354\235\270\355\225\230\353\213\210\354\271\264 \352\263\265\355\231\224\352\265\255.md" @@ -0,0 +1,66 @@ +```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 List[] V; + + public static void main(String[] args) throws Exception { + + for(int T=nextInt();T-->0;solve()) ready(); + + bwEnd(); + + } + + static void ready() throws Exception{ + + N = nextInt(); + M = nextInt(); + V = new List[N+1]; + for(int i=1;i<=N;i++) V[i] = new ArrayList<>(); + for(int i=1;i0 ? res : (int)1e7; + } + +} +``` From 20a0091765b22f9fdbfef25a226f007f3f7d9117 Mon Sep 17 00:00:00 2001 From: oncsr Date: Tue, 13 May 2025 18:35:30 +0900 Subject: [PATCH 2/4] =?UTF-8?q?[BOJ-11085]=20=EA=B5=B0=EC=82=AC=20?= =?UTF-8?q?=EC=9D=B4=EB=8F=99.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...0\354\202\254 \354\235\264\353\217\231.md" | 69 +++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 "\352\266\214\355\230\201\354\244\200_17\354\243\274\354\260\250/[BOJ-11085] \352\265\260\354\202\254 \354\235\264\353\217\231.md" diff --git "a/\352\266\214\355\230\201\354\244\200_17\354\243\274\354\260\250/[BOJ-11085] \352\265\260\354\202\254 \354\235\264\353\217\231.md" "b/\352\266\214\355\230\201\354\244\200_17\354\243\274\354\260\250/[BOJ-11085] \352\265\260\354\202\254 \354\235\264\353\217\231.md" new file mode 100644 index 00000000..7f31cb7f --- /dev/null +++ "b/\352\266\214\355\230\201\354\244\200_17\354\243\274\354\260\250/[BOJ-11085] \352\265\260\354\202\254 \354\235\264\353\217\231.md" @@ -0,0 +1,69 @@ +```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, S, E; + static int[][] G; + static int[] r; + + static int f(int x) {return x==r[x] ? x : (r[x]=f(r[x]));} + + public static void main(String[] args) throws Exception { + + ready(); + solve(); + + bwEnd(); + + } + + static void ready() throws Exception{ + + N = nextInt(); + M = nextInt(); + S = nextInt(); + E = nextInt(); + r = new int[N]; + for(int i=0;i b[2]-a[2]); + for(int[] e:G) { + int a = e[0], b = e[1], c = e[2]; + int x = f(a), y = f(b); + if(x == y) continue; + r[x] = y; + if(f(S) == f(E)) { + bw.write(c + "\n"); + return; + } + } + + } + +} +``` From 93457aca7d5b98506572dcef4ab0aa6e8fb6a5d2 Mon Sep 17 00:00:00 2001 From: oncsr Date: Tue, 13 May 2025 19:52:09 +0900 Subject: [PATCH 3/4] =?UTF-8?q?[BOJ-2842]=20=EC=A7=91=EB=B0=B0=EC=9B=90=20?= =?UTF-8?q?=ED=95=9C=EC=83=81=EB=8D=95.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...0 \355\225\234\354\203\201\353\215\225.md" | 105 ++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100644 "\352\266\214\355\230\201\354\244\200_17\354\243\274\354\260\250/[BOJ-2842] \354\247\221\353\260\260\354\233\220 \355\225\234\354\203\201\353\215\225.md" diff --git "a/\352\266\214\355\230\201\354\244\200_17\354\243\274\354\260\250/[BOJ-2842] \354\247\221\353\260\260\354\233\220 \355\225\234\354\203\201\353\215\225.md" "b/\352\266\214\355\230\201\354\244\200_17\354\243\274\354\260\250/[BOJ-2842] \354\247\221\353\260\260\354\233\220 \355\225\234\354\203\201\353\215\225.md" new file mode 100644 index 00000000..35c93b14 --- /dev/null +++ "b/\352\266\214\355\230\201\354\244\200_17\354\243\274\354\260\250/[BOJ-2842] \354\247\221\353\260\260\354\233\220 \355\225\234\354\203\201\353\215\225.md" @@ -0,0 +1,105 @@ +```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 = {-1,-1,-1,0,0,1,1,1}; + static final int[] dy = {-1,0,1,-1,1,-1,0,1}; + + static int N; + static char[][] A; + static int[][] H; + static int[] L; + static int sx, sy, cnt = 0; + + public static void main(String[] args) throws Exception { + + ready(); + solve(); + + bwEnd(); + + } + + static void ready() throws Exception{ + + N = nextInt(); + A = new char[N][]; + H = new int[N][N]; + L = new int[N*N]; + for(int i=0;i>1; + while(s>1; + } + if(m == L[N*N-1]+1) continue; + ans = Math.min(m-min, ans); + } + bw.write(ans + "\n"); + + } + + static boolean bfs(int l, int r) { + int fd = 0; + if(H[sx][sy] < l || H[sx][sy] > r) return false; + Queue Q = new LinkedList<>(); + Q.offer(new int[] {sx,sy}); + boolean[][] vis = new boolean[N][N]; + vis[sx][sy] = true; + while(!Q.isEmpty()) { + int[] now = Q.poll(); + int x = now[0], y = now[1]; + if(A[x][y] == 'K') { + fd++; + if(fd == cnt) return true; + } + for(int i=0;i<8;i++) { + int xx = x+dx[i], yy = y+dy[i]; + if(xx<0 || xx>=N || yy<0 || yy>=N || H[xx][yy] < l || H[xx][yy] > r || vis[xx][yy]) continue; + vis[xx][yy] = true; + Q.offer(new int[] {xx,yy}); + } + } + return false; + } + +} +``` From 080893a49e5497de49acaa1deafb478ce842c59f Mon Sep 17 00:00:00 2001 From: oncsr Date: Tue, 20 May 2025 08:35:24 +0900 Subject: [PATCH 4/4] [BOJ-1701] Cubeditor.md --- .../[BOJ-1701] Cubeditor.md" | 61 +++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 "\352\266\214\355\230\201\354\244\200_17\354\243\274\354\260\250/[BOJ-1701] Cubeditor.md" diff --git "a/\352\266\214\355\230\201\354\244\200_17\354\243\274\354\260\250/[BOJ-1701] Cubeditor.md" "b/\352\266\214\355\230\201\354\244\200_17\354\243\274\354\260\250/[BOJ-1701] Cubeditor.md" new file mode 100644 index 00000000..acf3b49f --- /dev/null +++ "b/\352\266\214\355\230\201\354\244\200_17\354\243\274\354\260\250/[BOJ-1701] Cubeditor.md" @@ -0,0 +1,61 @@ +```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 char[] B; + static int[] X; + + public static void main(String[] args) throws Exception { + + ready(); + solve(); + + bwEnd(); + + } + + static void ready() throws Exception{ + + B = br.readLine().toCharArray(); + + } + + static void solve() throws Exception { + + int max = 0; + for(int l=0;l0 && A[X[i]] != A[i]) X[i] = X[X[i]-1]; + if(A[X[i]] == A[i]) X[i]++; + max = Math.max(X[i], max); + } + } + bw.write(max + "\n"); + + } + +} +```