結果

問題 No.1298 OR XOR
ユーザー chineristACchineristAC
提出日時 2020-11-27 22:20:18
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 79 ms / 2,000 ms
コード長 347 bytes
コンパイル時間 986 ms
コンパイル使用メモリ 86,856 KB
実行使用メモリ 71,376 KB
最終ジャッジ日時 2023-10-01 06:32:01
合計ジャッジ時間 2,735 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 78 ms
71,376 KB
testcase_01 AC 77 ms
71,304 KB
testcase_02 AC 77 ms
71,240 KB
testcase_03 AC 77 ms
71,076 KB
testcase_04 AC 77 ms
71,020 KB
testcase_05 AC 79 ms
71,152 KB
testcase_06 AC 76 ms
71,060 KB
testcase_07 AC 76 ms
71,312 KB
testcase_08 AC 76 ms
71,076 KB
testcase_09 AC 76 ms
71,064 KB
testcase_10 AC 73 ms
71,128 KB
testcase_11 AC 75 ms
71,076 KB
testcase_12 AC 75 ms
71,016 KB
testcase_13 AC 74 ms
71,288 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,-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