結果

問題 No.1871 divisXor
ユーザー Shirotsume
提出日時 2022-03-11 23:02:16
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 272 bytes
コンパイル時間 239 ms
コンパイル使用メモリ 81,920 KB
実行使用メモリ 52,224 KB
最終ジャッジ日時 2024-09-16 03:23:21
合計ジャッジ時間 7,821 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 1
other AC * 1 WA * 28
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
ans = []
for i in range(n):
    if 2 ** i > n:
        break
    if 1 & (n >> i):
        ans.append(2 ** i)
xor = 0
summ = 0
for v in ans:
    xor ^= v
    summ += v

if xor == n and summ < 2 * n:
    print(len(ans))
    print(*ans)
else:
    print(-1)

0