301038: CF196C. Paint Tree

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Paint Tree

题意翻译

给你一棵$n$个点的树和$n$个平面直角坐标系上的点,现在要把树上的$n$个点映射到坐标系中的$n$个点上。要求是除了在顶点处不能有线段相交。 输入格式: 第一行$n$。 后面$n-1$行表示了一棵树,再后面$n$行表示坐标系的$n$个点。 输出格式: $n$个数,表示每个树节点对应坐标系中点的序号。

题目描述

You are given a tree with $ n $ vertexes and $ n $ points on a plane, no three points lie on one straight line. Your task is to paint the given tree on a plane, using the given points as vertexes. That is, you should correspond each vertex of the tree to exactly one point and each point should correspond to a vertex. If two vertexes of the tree are connected by an edge, then the corresponding points should have a segment painted between them. The segments that correspond to non-adjacent edges, should not have common points. The segments that correspond to adjacent edges should have exactly one common point.

输入输出格式

输入格式


The first line contains an integer $ n $ ( $ 1<=n<=1500 $ ) — the number of vertexes on a tree (as well as the number of chosen points on the plane). Each of the next $ n-1 $ lines contains two space-separated integers $ u_{i} $ and $ v_{i} $ ( $ 1<=u_{i},v_{i}<=n $ , $ u_{i}≠v_{i} $ ) — the numbers of tree vertexes connected by the $ i $ -th edge. Each of the next $ n $ lines contain two space-separated integers $ x_{i} $ and $ y_{i} $ ( $ -10^{9}<=x_{i},y_{i}<=10^{9} $ ) — the coordinates of the $ i $ -th point on the plane. No three points lie on one straight line. It is guaranteed that under given constraints problem has a solution.

输出格式


Print $ n $ distinct space-separated integers from $ 1 $ to $ n $ : the $ i $ -th number must equal the number of the vertex to place at the $ i $ -th point (the points are numbered in the order, in which they are listed in the input). If there are several solutions, print any of them.

输入输出样例

输入样例 #1

3
1 3
2 3
0 0
1 1
2 0

输出样例 #1

1 3 2

输入样例 #2

4
1 2
2 3
1 4
-1 -2
3 5
-3 3
2 0

输出样例 #2

4 2 1 3

说明

The possible solutions for the sample are given below. ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF196C/a95f8b6fcfb254d1f8656b062aef9bc93b0460d0.png)![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF196C/dfe0db226de1aa42fb5962aa07f4d0c31fb72c9c.png)

Input

题意翻译

给你一棵$n$个点的树和$n$个平面直角坐标系上的点,现在要把树上的$n$个点映射到坐标系中的$n$个点上。要求是除了在顶点处不能有线段相交。 输入格式: 第一行$n$。 后面$n-1$行表示了一棵树,再后面$n$行表示坐标系的$n$个点。 输出格式: $n$个数,表示每个树节点对应坐标系中点的序号。

加入题单

算法标签: