본문 바로가기

레야몬

검색하기
레야몬
프로필사진 Leyamon

  • 분류 전체보기 (194)
    • 나의 생활 (15)
      • 일기 (9)
      • 운동 (3)
    • 알고리즘 (176)
      • 백준 (161)
      • Algorithmic Problem Solving.. (13)
    • 물리 (1)
      • 고급 물리학 (1)
Guestbook
Notice
Recent Posts
Recent Comments
Link
  • 문현성 블로그
«   2025/05   »
일 월 화 수 목 금 토
1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31
Tags
  • 위상 정렬
  • 그리디
  • 백준
  • BFS
  • 그래프 이론
  • 트리
  • 정수론
  • DFS
  • 정렬
  • 알고리즘
  • 자료구조
  • 자료 구조
  • 기하학
  • 책
  • 이분 매칭
  • 수학
  • 세그먼트 트리
  • c언어
  • C++
  • 최소 공통 조상
  • 흰책
  • 하얀책
  • DP
  • 분할 정복
  • C++언어
  • 강한 연결 요소
  • 종만북
  • 문자열
  • 최대 유량
  • 우선순위 큐
more
Archives
Today
Total
관리 메뉴
  • 글쓰기
  • 방명록
  • RSS
  • 관리

목록Union-Find (1)

레야몬

[C++] 1197번 최소 스패닝 트리 - 최소 스패닝 트리, Union-Find

#include #include #include #include #define MAX_VERTEX 10001 #define MAX_TRUNK 100001 using namespace std; typedef long long int lld; int V, E; //정점의 개수 V, 간선의 개수 E vector map[MAX_TRUNK]; //정점의 연결관계 표시 맵 int root[MAX_VERTEX]; //union-find 용 lld w; //가중치의 합 int find(int x) //x의 루트 찾기 { if(root[x]==x) return x; else return root[x]=find(root[x]); } void _union(int x, int y) { x=find(x); y=find(y); ..

알고리즘/백준 2022. 9. 7. 19:30
이전 Prev 1 Next 다음

Blog is powered by kakao / Designed by Tistory

티스토리툴바