結果

問題 No.1298 OR XOR
ユーザー chineristACchineristAC
提出日時 2020-11-27 22:01:38
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 341 bytes
コンパイル時間 609 ms
コンパイル使用メモリ 86,732 KB
実行使用メモリ 71,624 KB
最終ジャッジ日時 2023-10-01 05:51:07
合計ジャッジ時間 3,671 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 79 ms
71,140 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 76 ms
71,328 KB
testcase_07 AC 80 ms
71,228 KB
testcase_08 AC 77 ms
71,256 KB
testcase_09 AC 75 ms
70,984 KB
testcase_10 AC 75 ms
71,180 KB
testcase_11 AC 74 ms
71,260 KB
testcase_12 AC 77 ms
71,348 KB
testcase_13 AC 78 ms
71,316 KB
権限があれば一括ダウンロードができます

ソースコード

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)
else:
    assert A|B==N
    assert B|C==N
    assert C|A==N
    assert A^B^C==0
    print(A,B,C)
0