結果

問題 No.3547 Rurumaru Function Problem
コンテスト
ユーザー 👑 loop0919
提出日時 2026-04-21 23:01:45
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 43 ms / 2,000 ms
コード長 559 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 226 ms
コンパイル使用メモリ 85,120 KB
実行使用メモリ 52,352 KB
最終ジャッジ日時 2026-05-22 21:46:23
合計ジャッジ時間 4,576 ms
ジャッジサーバーID
(参考情報)
judge1_1 / judge3_1
純コード判定待ち
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

N, M = [int(s) for s in input().split()]
ans = 0

for i in range(31):
    match (i % 2, (N >> i) & 1, (M >> i) & 1):
        case (0, 0, 0):
            ans |= 0 << i
        case (0, 0, 1):
            print(-1)
            exit()
        case (0, 1, 0):
            ans |= 0 << i
        case (0, 1, 1):
            ans |= 1 << i
        case (1, 0, 0):
            ans |= 0 << i
        case (1, 0, 1):
            ans |= 1 << i
        case (1, 1, 0):
            print(-1)
            exit()
        case (1, 1, 1):
            ans |= 0 << i

print(ans)
0