結果

問題 No.1298 OR XOR
ユーザー chineristAC
提出日時 2020-11-27 22:20:18
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 39 ms / 2,000 ms
コード長 347 bytes
コンパイル時間 415 ms
コンパイル使用メモリ 82,764 KB
実行使用メモリ 53,460 KB
最終ジャッジ日時 2024-07-26 13:20:34
合計ジャッジ時間 1,847 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

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

flag = 0
for i in range(31):
    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,-1,-1)
else:
    assert A|B==N
    assert B|C==N
    assert C|A==N
    assert A^B^C==0
    print(A,B,C)
0