logo AlgoBeat OnlineJudge
登录 注册

#203745. [CERC2014] Mountainous landscape

内存限制:125 MiB 时间限制:5000 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

You travel through a scenic landscape consisting mostly of mountains – there are landmarks (peaks and valleys) on your path. You pause for breath and wonder: which mountain are you currently seeing on the horizon?

0

Formally: you are given a polygonal chain in the plane. The coordinates of the points are in strictly increasing order. For each segment of this chain, find the smallest index , for which any point of is visible from (lies strictly above the ray ).

输入格式

The first line of input contains the number of test cases . The descriptions of the test cases follow:

The first line of each test case contains an integer – the number of vertices on the chain.

Each of the following lines contains integer coordinates of the vertex .

输出格式

For each test case, output a single line containing space-separated integers. These should be the smallest indices of chain segments visible to the right, or when no such segment exists.

样例

样例输入 1

2
8
0 0
3 7
6 2
9 4
11 2
13 3
17 13
20 7
7
0 2
1 2
3 1
4 0
5 2
6 1
7 3

样例输出 1

0 3 6 5 6 0 0
6 4 4 0 6 0