問題一覧 > 通常問題

No.1871 divisXor

レベル : / AI推定難易度 : 1500 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / スペシャルジャッジ問題 (複数の解が存在する可能性があります)
タグ : (AC するまで非表示) / 解いたユーザー数 98
作問者 : NaHCO314 / テスター : shiomusubi496 MtSaka
お気に入りにしたユーザー ProblemId : 7331 / 自分の提出
問題文最終更新日: 2022-03-11 15:27:38
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 335 (順位表) の他の問題:

Problem Statement

Define $f(x)$ as the sum of the positive divisors of $x$, and $a \oplus b$ as the bitwise XOR of $a$ and $b$.

You are given a non-negative integer $N$. Construct $1$ sequence of positive integers $A = (A_1, A_2, \ldots, A_M)$ that satisfies the following conditions.

  • $1 \le M \le 100$
  • $f(A_1) \oplus f(A_2) \oplus \cdots \oplus f(A_M) = N$
  • $A_1 + A_2 + \cdots + A_M \lt 2 \times N$
  • The elements of $A$ are pairwise distinct

However, if no $A$ satisfying the conditions exists, output $-1$.

Input

$N$
  • $N$ is an integer
  • $0\le N\le 10^{12}$

Output

If an $A$ satisfying the conditions exists, output it in the following format.

$M$
$A_1$ $A_2$ $\cdots$ $A_M$

If no $A$ satisfying the conditions exists, output $-1$ on a single line.

Sample

Sample 1
Input
17
Output
3
1 6 12

We have $f(1) \oplus f(6) \oplus f(12) = 1 \oplus 12 \oplus 28 = 17$. Also, $1 + 6 + 12 = 19 \lt 2 \times 17 = 34$, so the conditions are satisfied.

Sample 2
Input
0
Output
-1

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