問題一覧 > 通常問題

No.1829 Möbius Tunnelling

レベル : / AI推定難易度 : 1300 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 172
作問者 : riano / テスター : ygussany H20
お気に入りにしたユーザー ProblemId : 7500 / 自分の提出
問題文最終更新日: 2022-01-23 16:07:29
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 330 (順位表) の他の問題:

Problem Statement

$1$ long, thin sheet of paper is divided by boundaries into $N$ squares arranged in a straight line. Furthermore, this paper has a front and a back, and the back is also divided into $N$ squares in the same way, by boundaries at the same positions as on the front. On both the front and the back, these squares are numbered $1$ to $N$ in order from the left, and the $i$-th square of the back is directly behind the $i$-th square of the front.

Initially, A is on the $a$-th square of the front, B is on the $b$-th square of the front, and C is on the $c$-th square of the back. Is it possible, by performing the following operation $1$ time, to have A and C on the same side and A and B on different sides?

[Operation]
Make a Möbius strip out of this paper and cut it at any boundary of your choice.
Strictly speaking, give the paper a half twist and join it so that the $N$-th square of the front connects with the $1$-th square of the back and the $N$-th square of the back connects with the $1$-th square of the front. Then, choose any $1$ boundary between squares and cut there, returning it to $1$ flat sheet of paper (with a separate front and back).

Input

$N$
$a$ $b$ $c$

  • $2\leq N\leq 10^9$
  • $1\leq a,b,c \leq N$
  • $a\neq b$
  • All inputs are integers.

Output

Print Yes if an operation satisfying the conditions is possible, and No otherwise. Print a newline at the end.

Sample

Sample 1
Input
5
1 3 5
Output
Yes

The initial arrangement is as shown in Figure $1$. When the Möbius strip is made, A on the $1$-th square of the front and C on the $5$-th square of the back become adjacent. Therefore, for example, cutting at the boundary between squares $2$ and $3$ satisfies the conditions of the problem statement, as shown in Figure $2$.

Sample 2
Input
10
5 2 5
Output
No

Note that the input guarantees $a\neq b$, but does not guarantee $a\neq c$ or $b\neq c$.

Sample 3
Input
1000000000
271828182 314159265 141421356
Output
No

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。