

Time Limit: 2 sec / Memory Limit: 1024 MB
配点 : 点
問題文
平面上に高橋くんがいます。 はじめ、高橋くんは点 にいます。 高橋くんは、点 に移動したいです。
平面上に、長方形 があります。 次の操作を考えます。
- 長方形 に含まれる格子点 をひとつ選ぶ。 点 を中心に高橋くんはいまいる位置と対称な位置に瞬間移動する。
上の操作を 回以上 回以下繰り返して、高橋くんが点 にいるようにできるか判定してください。 できる場合、高橋くんが点 に移動することができるような操作の列を つ構成してください。
制約
- 入力はすべて整数
入力
入力は以下の形式で標準入力から与えられる。
出力
行目には、操作を 回以上 回以下繰り返して高橋くんが点 に到達できるなら Yes
、そうでなければ No
と出力せよ。
行目で Yes
と出力したとき、かつそのときに限り、あなたが構成した操作列の長さを としてさらに 行出力せよ( は を満たさなければならない)。
行目 には、 回目の操作で選んだ点 の座標をこの順に空白区切りで出力せよ。
入力例 1Copy
1 2 7 8 7 9 0 3
出力例 1Copy
Yes 7 0 9 3 7 1 8 1
例えば、次のようにして から へ移動することができます。
- 点 を選ぶ。高橋くんは に移動する。
- 点 を選ぶ。高橋くんは に移動する。
- 点 を選ぶ。高橋くんは に移動する。
- 点 を選ぶ。高橋くんは に移動する。
条件を満たす操作の列であれば何を出力しても正答となるので、例えば
Yes 7 3 9 0 7 2 9 1 8 1
と出力しても正答となります。
入力例 2Copy
0 0 8 4 5 5 0 0
出力例 2Copy
No
どのように操作しても点 に移動することはできません。
入力例 3Copy
1 4 1 4 100 200 300 400
出力例 3Copy
Yes
高橋くんがはじめから目的地にいる場合もあります。
入力例 4Copy
22 2 16 7 14 30 11 14
出力例 4Copy
No
Score : points
Problem Statement
Takahashi is on an -plane. Initially, he is at point , and he wants to reach point .
On the -plane is a rectangle . Consider the following operation:
- Choose a lattice point contained in the rectangle . Takahashi teleports to the point symmetric to his current position with respect to point .
Determine if he can reach point after repeating the operation above between and times, inclusive. If it is possible, construct a sequence of operations that leads him to point .
Constraints
- All values in the input are integers.
Input
The input is given from Standard Input in the following format:
Output
In the first line, print Yes
if Takahashi can reach point after repeating the operation between and times, inclusive, and No
otherwise.
If and only if you print Yes
in the first line, print more lines, where is the length of the sequence of operations you have constructed ( must satisfy ).
The -th line should contain the space-separated coordinates of the point , in this order, that is chosen in the -th operation.
Sample Input 1Copy
1 2 7 8 7 9 0 3
Sample Output 1Copy
Yes 7 0 9 3 7 1 8 1
For example, the following choices lead him from to .
- Choose . Takahashi moves to .
- Choose . Takahashi moves to .
- Choose . Takahashi moves to .
- Choose . Takahashi moves to .
Any output that satisfies the conditions is accepted; for example, printing
Yes 7 3 9 0 7 2 9 1 8 1
is also accepted.
Sample Input 2Copy
0 0 8 4 5 5 0 0
Sample Output 2Copy
No
No sequence of operations leads him to point .
Sample Input 3Copy
1 4 1 4 100 200 300 400
Sample Output 3Copy
Yes
Takahashi may already be at the destination in the beginning.
Sample Input 4Copy
22 2 16 7 14 30 11 14
Sample Output 4Copy
No