From 560f3edf12b576f704528773afb9181d62e542e9 Mon Sep 17 00:00:00 2001 From: LiiNi-coder <97495437+LiiNi-coder@users.noreply.github.com> Date: Tue, 14 Oct 2025 22:46:26 +0900 Subject: [PATCH] =?UTF-8?q?[20251014]=20BOJ=20/=20G4=20/=20=EB=8F=84?= =?UTF-8?q?=EC=8B=9C=20=EB=B6=84=ED=95=A0=20=EA=B3=84=ED=9A=8D=20/=20?= =?UTF-8?q?=EC=9D=B4=EC=9D=B8=ED=9D=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...4\355\225\240 \352\263\204\355\232\215.md" | 80 +++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 "LiiNi-coder/202510/14 BOJ \353\217\204\354\213\234 \353\266\204\355\225\240 \352\263\204\355\232\215.md" diff --git "a/LiiNi-coder/202510/14 BOJ \353\217\204\354\213\234 \353\266\204\355\225\240 \352\263\204\355\232\215.md" "b/LiiNi-coder/202510/14 BOJ \353\217\204\354\213\234 \353\266\204\355\225\240 \352\263\204\355\232\215.md" new file mode 100644 index 00000000..5976bd5c --- /dev/null +++ "b/LiiNi-coder/202510/14 BOJ \353\217\204\354\213\234 \353\266\204\355\225\240 \352\263\204\355\232\215.md" @@ -0,0 +1,80 @@ +```java +import java.io.*; +import java.util.*; + +public class Main { + private static int N, M; + private static int[] Parent; + private static List Edges = new ArrayList<>(); + + private static class Edge implements Comparable { + int from, to, cost; + Edge(int from, int to, int cost) { + this.from = from; + this.to = to; + this.cost = cost; + } + @Override + public int compareTo(Edge e) { + return this.cost - e.cost; + } + } + + public static void main(String[] args)throws IOException{ + BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + StringTokenizer st = new StringTokenizer(br.readLine()); + N = Integer.parseInt(st.nextToken()); + M = Integer.parseInt(st.nextToken()); + Parent = new int[N+1]; + + + for(int i=1; i<=N; i++){ + Parent[i] = i; + } + + for(int i=0; i