AtCoder Regular Contest 167
E
One Square in a Triangle
AtCoder
⌀ 3271
原题
← DF →
翻译中…

Problem Statement

翻译中…

A triangle $ABC$ on the $xy$-plane is said to be a good triangle when it satisfies all of the following conditions.

翻译中…
  • Each of the vertices $A$, $B$, and $C$ is a lattice point whose $x$- and $y$-coordinates are between $0$ and $10^{8}$, inclusive.
  • The triangle $ABC$ (including the perimeter and vertices) wholly contains exactly one square of area $1$ whose vertices are all lattice points.
翻译中…

You are given a positive integer $S$.

翻译中…

Determine if there is a good triangle of area $\frac{S}{2}$, and construct one if it exists.

翻译中…

For each input file, you have $T$ test cases to solve.

翻译中…

Constraints

翻译中…
  • $1\leq T\leq 10^{5}$
  • $1\leq S\leq 10^{8}$
  • All input values are integers.
翻译中…

Input

翻译中…

The input is given from Standard Input in the following format:

翻译中…

T
\text{case}_{1}
\text{case}_{2}
\vdots
\text{case}_{T}

翻译中…

Each case is given in the following format:

翻译中…

S

翻译中…

Output

翻译中…

For each case, print No if there is no good triangle of area $\frac{S}{2}$, and such a triangle in the following format if there is one.

翻译中…

Yes
AX AY BX BY CX CY

翻译中…

Here, $AX$, $BX$, $CX$ are the $x$-coordinates of $A$, $B$, $C$, and $AY$, $BY$, $CY$ are the $y$-coordinates of $A$, $B$, $C$, respectively.

翻译中…

When printing Yes or No, you may use either uppercase or lowercase English letters. If multiple solutions exist, any of them will be accepted.

翻译中…

样例

Input #1
3
1
4
15
Output #1
No
Yes
1 1 1 3 3 3
Yes
5 1 7 8 4 5
![image](https://img.atcoder.jp/arc167/d6986726412312ca9a6e022bc8e722ce.png) In the figure, the left and right triangles correspond to the second and third test cases, respectively.
题目信息
题号
arc167_e
时间限制
2 s
内存限制
1024 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。