#570. 「Nowcoder多校 2019 Day2」Polygons

「Nowcoder多校 2019 Day2」Polygons

题目描述

Lines make polygons. Given N lines, please tell how many closed polygons are formed by these N straight lines and what is the largest and smallest area of them? Moreover, could you tell qiq_i-th largest area?

输入格式

The first line of input contains an integers N indicating the number of lines. Following N lines each contains four space-separated integers x1,y1,x2,y2x_1, y_1, x_2, y_2 indicating two points on the i-th line. The next line contains an integer M indicating the number of questions. Following M lines each contains an integer qiq_i​.

输出格式

First output a single line containing three numbers, the number of closed polygons, the largest area and the smallest area. Then, output m lines each contains a number indicating qiq_i-th largest area. If qiq_i is greater than the number of polygons, output ""Invalid question"\texttt{"Invalid question"}(without quotes) instead. Your answer will be considered correct if its absolute or relative error doesn't exceed 10410^{-4}

样例

样例输入 1

6
1 1 0 2
1 3 0 4
1 6 0 7
1 3 0 2
1 -1 0 -2
1 4 0 4
7
1
2
3
4
5
6
7

样例输出 1

6 5.75 0.25
5.75
4.0
3.0
2.25
1.0
0.25
Invalid question

数据范围与提示

3≤N≤1000

1M100001M100001≤M≤100001 \leq M \leq 10000

xi,yi1000|x_i|, |y_i| \leq 1000

1qi1091 \leq q_i \leq 10^9

No three lines intersect in one point No two lines coincide There is at least 1 closed polygon