結果

問題 No.1298 OR XOR
ユーザー chineristACchineristAC
提出日時 2020-11-27 21:59:48
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 341 bytes
コンパイル時間 274 ms
コンパイル使用メモリ 86,816 KB
実行使用メモリ 71,580 KB
最終ジャッジ日時 2023-10-01 05:43:47
合計ジャッジ時間 2,969 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,056 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 73 ms
71,256 KB
testcase_07 AC 71 ms
71,352 KB
testcase_08 AC 72 ms
71,284 KB
testcase_09 AC 72 ms
71,232 KB
testcase_10 AC 73 ms
71,252 KB
testcase_11 AC 73 ms
71,456 KB
testcase_12 AC 71 ms
71,044 KB
testcase_13 AC 72 ms
71,312 KB
権限があれば一括ダウンロードができます

ソースコード

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