Broken Line 02

아직 제출이 없습니다시간 제한0.1초메모리 제한512 MB

문제

Azerbaijan is famous for its carpets. As a master carpet designer you want to make a new design by drawing a broken line. A broken line is a sequence of tt line segments in a two-dimensional plane, which is defined by a sequence of t+1t+1 points p_0,,p_tp\_0, \ldots, p\_t as follows. For each 0jt10 \leq j \leq t-1 there is a segment connecting points p_jp\_j and p_j+1p\_{j+1}.

In order to make the new design, you have already marked nn dots in a two-dimensional plane. The coordinates of dot ii (1in1 \leq i \leq n) are (x\[i],y\[i])(x\[i], y\[i])No two dots have the same x or the same y coordinate.

You now want to find a sequence of points (sx\[0],sy\[0]),(sx\[1],sy\[1]),,(sx\[k],sy\[k])(sx\[0], sy\[0]), (sx\[1], sy\[1]), \ldots, (sx\[k], sy\[k]), which defines a broken line that

  • starts at (0,0)(0, 0) (that is, sx\[0]=0sx\[0] = 0 and sy\[0]=0sy\[0] = 0),
  • contains all of the dots (not necessarily as the endpoints of the segments), and
  • consists solely of horizontal or vertical segments (two consecutive points defining the broken line have an equal x or y coordinate).

The broken line is allowed to intersect or overlap itself in any way. Formally, each point of the plane may belong to any number of segments of the broken line.

This is an output-only task with partial scoring. You are given 1010 input files specifying the locations of dots. For each input file, you should submit an output file describing a broken line with the required properties. For each output file that describes a valid broken line your score depends on the number of segments in the broken line (see Scoring below).

입력

Each input file is in the following format:

  • line 11: ;;n\\;\\;n
  • line 1+i1+i (for 1in1 \leq i \leq n): ;;x\[i];;y\[i]\\;\\; x\[i] \\;\\; y\[i]

출력

Each output file must be in the following format:

  • line 11: ;;k\\;\\;k
  • line 1+j1+j (for 1jk1 \leq j \leq k): ;;sx\[j];;sy\[j]\\;\\; sx\[j] \\;\\; sy\[j]

Note that the second line should contain sx\[1]sx\[1] and sy\[1]sy\[1] (i.e., the output should not contain sx\[0]sx\[0] and sy\[0]sy\[0]). Each sx\[j]sx\[j] and sy\[j]sy\[j] should be an integer.

제한

  •  
  • 1n100,0001 \leq n \leq 100\\,000
  • 1x\[i],y\[i]1091 \leq x\[i], y\[i] \leq {10}^9
  • All values of x\[i]x\[i] and y\[i]y\[i] are integers.
  • No two dots have the same xx or the same yy coordinates, i.e. x\[i_1]x\[i_2]x\[i\_1] \neq x\[i\_2] and y\[i_1]y\[i_2]y\[i\_1] \neq y\[i\_2] for i_1i_2i\_1 \neq i\_2.
  • 2109sx\[j],sy\[j]2109-2 \cdot {10}^9 \leq sx\[j], sy\[j] \leq 2 \cdot {10}^9