当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

5539:Security Corporation

Special Judge 特殊评判
题目描述
Due to the high crime rate of Bytecity, the new mayor has decided to employ security agents from $c$ different security corporations. As a first step, he'll arrange a security agent from any of the corporation at each intersection of two roads in Bytecity.

The Bytecity has a very special and complex transportation system. There are $n$ straight and long roads in the city, each of them can be treated as an infinitely long line on a two dimensional plane, and no $3$ or more roads have a common intersection.

In order to prevent agents from slacking during work, the mayor has decided to arrange agents from two different security corporations at any two adjacent intersections. We said that two intersections are adjacent if they are on a same road, and there is no other intersection between these two intersections on that road. Also, the mayor thinks less number of security corporations is more manageable. Can you help the mayor to distribute all the intersections to as less security corporations as possible?
输入解释
The first line of input contains an integer $T$ indicating the total number of test cases. The first line of each test case is an integer $n$, indicating the number of roads in Bytecity. The $n$ lines that follow describes roads in Bytecity, the $i$-th of these lines contains $4$ integers $x1_i, y1_i, x2_i, y2_i$, indicating road $i$ is a straight line through $(x1_i, y1_i)$, $(x2_i, y2_i)$ on the plane.

$1 \le T \le 1000$.
$2 \le n \le 1000$.
$-10^3 \le x1_i, y1_i, x2_i, y2_i \le 10^3$.
$(x1_i,y1_i) \neq (x2_i, y2_i)$.
There are at most $10$ test cases with $n > 100$.
There are no $2$ identical roads, and at least $1$ intersection exists in each test case.
输出解释
For each test case, please output an integer $c$ in the first line indicating the minimum number of different corporations in your arrangement. Following $n-1$ lines, the $i$-th line of these lines should contain integers $a_{i,i+1}, a_{i,i+2}, ..., a_{i,n}$ in one line. The number $a_{i,j}$ indicates the security corporation that manages the intersection of road $i$ and road $j$, if the intersection does not exist, $a_{i,j}$ should be $-1$.

Note that all the corporations should be numbered as an integer from $1$ to $c$, and any arrangement that satisfy the mayor's requirement would be accepted.
输入样例
2
3
0 0 1 0
0 0 0 1
1 0 0 1
3
0 0 1 0
0 1 0 2
1 0 1 1
输出样例
3
1 2
3
2
2 1
-1
来自杭电HDUOJ的附加信息
Recommend hujie

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-5539

最后修改于 2020-10-25T23:23:35+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
20000/20000MS(Java/Others) 262144/262144K(Java/Others)