유니온 파인드

computer_log·2023년 9월 21일
0
#include <iostream>
#include <cstring>
using namespace std;

int myBoss[200];
int N, M;
int a, b;
int find(int n) {
	if (myBoss[n] == 0)return n;
	int ret = find(myBoss[n]);//찾고자 하는 
	myBoss[n] = ret;//묶어준다
	return ret;
}
int main() {
	cin >> N >> M;
	for (int i = 0; i < M; i++) {
		cin >> a >> b;
		
	}
	return 0;
}
profile
computer_log

0개의 댓글