트리

· Algorithm
https://www.acmicpc.net/problem/1967 1967번: 트리의 지름 파일의 첫 번째 줄은 노드의 개수 n(1 ≤ n ≤ 10,000)이다. 둘째 줄부터 n-1개의 줄에 각 간선에 대한 정보가 들어온다. 간선에 대한 정보는 세 개의 정수로 이루어져 있다. 첫 번째 정수는 간선이 연 www.acmicpc.net #include #include #include #include using namespace std; int n, p, c, cost; vector tree[10001]; int maxi = -1; int each[10001]; int Recursion(int root) { if(each[root]>-1) return each[root]; if(tree[root].size() ..
Yannoo
'트리' 태그의 글 목록