#P4758. [CERC2014] Mountainous landscape
[CERC2014] Mountainous landscape
题目描述
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?
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.
题目大意
- 给定平面内一个由点依次连接起来形成的折线 ,保证 坐标递增。
- 对于折线上的所有线段,找到最小的 ,使得存在一个在 上的点可以被 上的任何一个点看到,也就是严格在射线 上方。若没有,输出 .
- 多组数据。
,坐标均在 以内。