A rectangular area specified in world coordinates is called a window. The rectangular area on the display device to which a window is mapped is called a viewport. The picture elements that fall within this window area is visible. In the viewport there is a block which is given higher priority for displaying. That is, those line segments that falls behind the block will not be visible. Assume the boundaries of a viewport: x=x_{min}x=xminx=x_{max}x=xmaxy=y_{min}y=yminy=y_{max}y=ymax, the boundaries of block: x'=x'_{min}x=xminx'=x'_{max}x=xmaxy'=y'_{min}y=yminy'=y'_{max}y=ymax, and (x_{i1}\ , y_{i1} )(xi1 ,yi1) (x_{i2}\ , y_{i2})(xi2 ,yi2) : he endpoints of the lines in device coordinates.

???Line Segments Clipped by Windows

Please calculate the coordinate value of the endpoints of all the visible line.

Input Format:

The boundaries of a viewport and block, endpoints of the lines in device coordinates.

x_{min}xmin y_{min}ymin x_{max}xmax y_{max}ymax

x'_{min}xmin y'_{min}ymin x'_{max}xmax y'_{max}ymax

x_{11}x11 y_{11}y11 x_{12}x12 y_{12}y12

x_{21}x21 y_{21}y21 x_{22}x22 y_{22}y22

......

x_{n1}xn1 y_{n1}yn1 x_{n2}xn2 y_{n2}yn2

Output Format:

Endpoints of all the visible lines. Please sort the coordinate values of x'_{i1}xi1 ’s in descending order.

x'_{11}x11 y'_{11}y11 x'_{12}x12 y'_{12}y12

x'_{21}x21 y'_{21}y21 x'_{22}x22 y'_{22}y22

......

x'_{k1}xk1 y'_{k1}yk1 x'_{k2}xk2 y'_{k2}yk2

Note:

1. x'_{i1}\ <\ x'_{i2}xi1 < xi2

2. In the condition of only the endpoints of the segments are falling on the boundaries of the viewport or block and the other part is invisible, please neglect it.

3. Integers: x_{min}xminy_{min}ymin , x_{max}xmax , y_{max}ymaxx'_{min}xmin , y'_{min}ymin , x'_{max}xmax , y'_{max}ymax ; float: x_{ij}xijy_{ij}yij.

4. All float number should be accurate to 10^{-4}104

样例输入

0 0 5 5
1 2 2 3
3.0 3.0 7.0 7.0
9.0 7.0 2.0 6.0
4.0 2.0 1.1 4.0
9.0 -1.0 5.1 7.0
2.0 2.0 1.0 3.0
-2.5 3.1 5.2 -3.0
-1.0 7.3 -2.1 0.6
-2.1 5.6 6.0 7.0
-0.7 2.1 -5.2 12.6

样例输出

3.0000 3.0000 5.0000 5.0000
1.1000 4.0000 4.0000 2.0000
0.0000 1.1195 1.4131 0.0000

题目来源

2017 ACM-ICPC 亚洲区(南宁赛区)网络赛

相关文章:

  • 2022-01-14
  • 2021-12-17
  • 2021-12-02
  • 2021-05-05
  • 2021-10-29
  • 2022-02-15
  • 2021-10-06
  • 2022-12-23
猜你喜欢
  • 2021-04-13
  • 2022-12-23
  • 2021-11-30
  • 2022-12-23
  • 2022-01-13
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案