結果
| 問題 | No.1871 divisXor |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-03-11 23:07:41 |
| 言語 | PyPy3 (7.3.23 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 57 ms / 2,000 ms |
| + 190µs | |
| コード長 | 265 bytes |
| 記録 | |
| コンパイル時間 | 394 ms |
| コンパイル使用メモリ | 96,328 KB |
| 実行使用メモリ | 78,876 KB |
| 最終ジャッジ日時 | 2026-09-02 11:39:31 |
| 合計ジャッジ時間 | 4,511 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 29 |
ソースコード
n = int(input())
ans = []
xor = 0
for i in range(40, -1, -1):
if 2 ** i > n:
continue
if 1 & (xor >> i) != 1 & (n >> i):
ans.append(2 ** i)
xor ^= 2 ** (i + 1) - 1
if n == 0:
print(-1)
else:
print(len(ans))
print(*ans)