A certain forest consists of N trees, each of which is inhabited by a squirrel.
The boundary of the forest is the convex polygon of smallest area which contains every tree, as if a giant rubber band had been stretched around the outside of the forest.
Formally, every tree is a single point in two-dimensional space with unique coordinates (X_{i}, Y_{i}), and the boundary is the convex hull of those points.
Some trees are on the boundary of the forest, which means they are on an edge or a corner of the polygon. The squirrels wonder how close their trees are to being on the boundary of the forest.
One at a time, each squirrel climbs down from its tree, examines the forest, and determines the minimum number of trees that would need to be cut down for its own tree to be on the boundary. It then writes that number down on a log.
Determine the list of numbers written on the log.
The first line of the input gives the number of test cases, T. T test cases follow; each consists of a single line with an integer N, the number of trees, followed by N lines with two space-separated integers X_{i} and Y_{i}, the coordinates of each tree. No two trees will have the same coordinates.
For each test case, output one line containing "Case #x:", followed by N lines with one integer each, where line i contains the number of trees that the squirrel living in tree i would need to cut down.
-10^{6} ≤ X_{i}, Y_{i} ≤ 10^{6}.
1 ≤ T ≤ 100.
1 ≤ N ≤ 15.
1 ≤ T ≤ 14.
1 ≤ N ≤ 3000.
Input |
Output |
2 5 0 0 10 0 10 10 0 10 5 5 9 0 0 5 0 10 0 0 5 5 5 10 5 0 10 5 10 10 10 |
Case #1: 0 0 0 0 1 Case #2: 0 0 0 0 3 0 0 0 0 |
Points | Correct | Attempted |
---|---|---|
18pt | 1150 | 1668 |
34pt | 354 | 673 |