From 77fbdea3495d97173cf025cdbf1b2b0269092a55 Mon Sep 17 00:00:00 2001 From: seongwon030 <105052068+seongwon030@users.noreply.github.com> Date: Mon, 22 Jul 2024 11:42:51 +0900 Subject: [PATCH] =?UTF-8?q?2024-07-22=20=EC=A7=91=ED=95=A9=EC=9D=98?= =?UTF-8?q?=ED=91=9C=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...51\354\235\230\355\221\234\355\230\204.py" | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 "seongwon030/\354\234\240\353\213\210\354\230\250\355\214\214\354\235\270\353\223\234/\354\247\221\355\225\251\354\235\230\355\221\234\355\230\204.py" diff --git "a/seongwon030/\354\234\240\353\213\210\354\230\250\355\214\214\354\235\270\353\223\234/\354\247\221\355\225\251\354\235\230\355\221\234\355\230\204.py" "b/seongwon030/\354\234\240\353\213\210\354\230\250\355\214\214\354\235\270\353\223\234/\354\247\221\355\225\251\354\235\230\355\221\234\355\230\204.py" new file mode 100644 index 0000000..5417b7b --- /dev/null +++ "b/seongwon030/\354\234\240\353\213\210\354\230\250\355\214\214\354\235\270\353\223\234/\354\247\221\355\225\251\354\235\230\355\221\234\355\230\204.py" @@ -0,0 +1,27 @@ +import sys +input = sys.stdin.readline + +n,m = map(int,input().split()) +parent = [i for i in range(n+1)] + +def find(x): + if x!=parent[x]: + parent[x] = find(parent[x]) + return parent[x] + +def union(x,y): + x,y = find(x),find(y) + if x