結果

問題 No.1298 OR XOR
ユーザー chineristAC
提出日時 2020-11-27 21:59:48
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 341 bytes
コンパイル時間 168 ms
コンパイル使用メモリ 81,920 KB
実行使用メモリ 52,224 KB
最終ジャッジ日時 2024-07-26 12:36:49
合計ジャッジ時間 2,011 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 8 WA * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A,B,C = 0,0,0

flag = 0
for i in range(30):
    if N>>i & 1:
        if flag==0:
            A+= 2**i
            B+= 2**i
        else:
            B += 2**i
            C += 2**i
        flag += 1

if A*B*C==0:
    print(-1)
else:
    assert A|B==N
    assert B|C==N
    assert C|A==N
    assert A^B^C==0
    print(A,B,C)
0