Tree Embedding
시간 제한1초메모리 제한1024 MB
가중치가 있는 트리의 각 정점에 m차원 벡터를 부여해 두 벡터 차의 L-무한대 노름이 두 정점 사이의 트리 거리와 같도록 만든다.
문제
bobo has a tree with vertices. bobo would like to assign an -dimension vector to vertex , such that for all , .
Note that is the length of the shortest path between vertices and . For two vectors and , .
입력
The first line contains an integer ().
Vertices are numbered by for convenience.
Each of the following lines contains integers , which denotes an edge between vertices and with length ().
출력
The first line contains an integer , which denotes the dimension of vectors ().
Each of the following lines contains integers which denotes the vector . The coordinates should be in .
Any appropriate solution will get accepted.