hihoCoder #1582 : Territorial Dispute 凸包
Posted LuZhiyuan
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了hihoCoder #1582 : Territorial Dispute 凸包相关的知识,希望对你有一定的参考价值。
-
#1582 : Territorial Dispute
时间限制:1000ms单点时限:1000ms内存限制:256MB描述
In 2333, the C++ Empire and the Java Republic become the most powerful country in the world. They compete with each other in the colonizing the Mars.
There are n colonies on the Mars, numbered from 1 to n. The i-th colony‘s location is given by a pair of integers (xi, yi). Notice that latest technology in 2333 finds out that the surface of Mars is a two-dimensional plane, and each colony can be regarded as a point on this plane. Each colony will be allocated to one of the two countries during the Mars Development Summit which will be held in the next month.
After all colonies are allocated, two countries must decide a border line. The Mars Development Convention of 2048 had declared that: A valid border line of two countries should be a straight line, which makes colonies ofdifferent countries be situated on different sides of the line.
The evil Python programmer, David, notices that there may exist a plan of allocating colonies, which makes the valid border line do not exist. According to human history, this will cause a territorial dispute, and eventually lead to war.
David wants to change the colony allocation plan secretly during the Mars Development Summit. Now he needs you to give him a specific plan of allocation which will cause a territorial dispute. He promises that he will give you 1000000007 bitcoins for the plan.
输入
The first line of the input is an integer T, the number of the test cases (T ≤ 50).
For each test case, the first line contains one integer n (1 ≤ n ≤ 100), the number of colonies.
Then n lines follow. Each line contains two integers xi, yi (0 ≤ xi, yi ≤ 1000), meaning the location of the i-th colony. There are no two colonies share the same location.
There are no more than 10 test cases with n > 10.
输出
For each test case, if there exists a plan of allocation meet David‘s demand, print "YES" (without quotation) in the first line, and in the next line, print a string consisting of English letters "A" and "B". The i-th character is "A" indicates that the i-th colony was allocated to C++ Empire, and "B" indicates the Java Republic.
If there are several possible solutions, you could print just one of them.
If there is no solution, print "NO".
注意
This problem is special judged.
- 样例输入
-
2 2 0 0 0 1 4 0 0 0 1 1 0 1 1
- 样例输出
-
NO YES ABBA
以上是关于hihoCoder #1582 : Territorial Dispute 凸包的主要内容,如果未能解决你的问题,请参考以下文章
hihoCoder 1582 Territorial Dispute 凸包(ACM-ICPC国际大学生程序设计竞赛北京赛区(2017)网络赛)