結果

問題 No.2881 Mod 2^N
ユーザー 👑 loop0919
提出日時 2025-09-03 22:43:05
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 454 bytes
コンパイル時間 316 ms
コンパイル使用メモリ 82,052 KB
実行使用メモリ 54,628 KB
最終ジャッジ日時 2025-09-03 22:43:11
合計ジャッジ時間 5,761 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 3
other AC * 13 WA * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import pairwise

N, X, Y = map(int, input().split())

if Y % 2 == 0:
    if X == Y:
        print(0)
        print()
    else:
        print(-1)
    exit()

op = []
op.append(N)

idxes = [i + 1 for i in range(N) if (Y >> i) & 1][::-1]

for next_i, curr_i in pairwise(idxes):
    op.append(next_i - curr_i)

print(len(op))
print(*op)

# test
_x = X
print(_x)
for cmd in op:
    _x = (_x * 2**cmd + 1) % 2**N

assert _x == Y, f"{_x=}, {Y=}"
0