Perpendicular Segments

You are given a coordinate plane and three integers X, Y, and K. Find two line segments AB and CD such that:

  1. the coordinates of points A, B, C, and D are integers;
  2. 0 <= Ax, Bx, Cx, Dx <= X and 0 <= Ay, By, Cy, Dy <= Y;
  3. the length of segment AB is at least K;
  4. the length of segment CD is at least K;
  5. segments AB and CD are perpendicular: if you draw the lines that contain them, the lines cross at a right angle.

The segments do not need to intersect. They are perpendicular as long as the lines they induce are perpendicular.

Return the eight coordinates as a single flat array:

[Ax, Ay, Bx, By, Cx, Cy, Dx, Dy]

Any valid construction is accepted. If multiple answers exist, return any one of them.

The official input guarantee is that an answer exists. For an axis-aligned rectangle, that guarantee is equivalent to 2 * min(X, Y)^2 >= K^2, so min(X, Y) can be smaller than K when the segments are diagonal.

Examples
Input: [1,1,1]
Output: [0,0,1,1,0,1,1,0]
Hints

Perpendicular Segments

You are given a coordinate plane and three integers `X`, `Y`, and `K`. Find two line segments `AB` and `CD` such that: