No.2024 Xer
レベル :
/ AI推定難易度 : 1800
/ 実行時間制限 : 1ケース 2.000秒 / メモリ制限
: 512 MB / 標準ジャッジ問題
タグ : / 解いたユーザー数 99
作問者 :
milkcoffee
/ テスター :
first_vil
タグ : / 解いたユーザー数 99
作問者 :
milkcoffee
/ テスター :
問題文最終更新日: 2022-07-27 14:38:41
English (AI translation)
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 354 (オムニバス)
(順位表)
の他の問題:
Problem Statement
You are given a sequence $A$ of $N$ non-negative integers and a non-negative integer $X$. You may rearrange the elements of $A$ freely.
Is it possible to rearrange $A$ so that the following condition is satisfied?
- For each integer $i \ (1 \leq i \leq N-1)$, both of the following hold.
- $A_i < A_{i+1} \ \mathrm{xor} \ X$
- $A_i \ \mathrm{xor} \ X < A_{i+1} $
Input
$N\ \ X$ $A_1 \ \ A_2 \ \cdots \ A_N $
- $2 \leq N \leq 2 \times 10^5$
- $0 \leq X < 2^{30}$
- $0 \leq A_i < 2^{30} \ (1 \leq i \leq N)$
- All input values are integers.
Output
Print Yes if $A$ can be rearranged so that the condition is satisfied, and No otherwise.
Sample
Sample 1
Input
3 2 4 0 8
Output
Yes
For example, the arrangement $A=(0,4,8)$ satisfies the condition.
Sample 2
Input
2 0 1000000000 1000000000
Output
No
No rearrangement satisfies the condition.
Sample 3
Input
21 58 83 288 284 150 486 432 167 474 221 137 241 207 13 460 428 466 20 471 334 173 422
Output
No
Sample 4
Input
20 36251 312825 61132 198714 286989 525118 68197 276005 239658 483138 88020 214783 133172 117691 301236 416410 575820 339887 255432 6 263987
Output
Yes
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。