結果

問題 No.1298 OR XOR
ユーザー ShirotsumeShirotsume
提出日時 2023-02-17 20:02:39
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 97 ms / 2,000 ms
コード長 533 bytes
コンパイル時間 307 ms
コンパイル使用メモリ 87,180 KB
実行使用メモリ 71,728 KB
最終ジャッジ日時 2023-09-26 17:25:18
合計ジャッジ時間 2,760 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 94 ms
71,408 KB
testcase_01 AC 95 ms
71,420 KB
testcase_02 AC 97 ms
71,360 KB
testcase_03 AC 93 ms
71,556 KB
testcase_04 AC 93 ms
71,496 KB
testcase_05 AC 93 ms
71,696 KB
testcase_06 AC 94 ms
71,456 KB
testcase_07 AC 94 ms
71,712 KB
testcase_08 AC 95 ms
71,424 KB
testcase_09 AC 93 ms
71,524 KB
testcase_10 AC 94 ms
71,728 KB
testcase_11 AC 94 ms
71,628 KB
testcase_12 AC 94 ms
71,428 KB
testcase_13 AC 95 ms
71,416 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from collections import deque, Counter
input = lambda: sys.stdin.readline().rstrip()
ii = lambda: int(input())
mi = lambda: map(int, input().split())
li = lambda: list(mi())

n = ii()

a, b, c = 0, 0, 0
p = 1
if bin(n).count('1') == 1:
    print(-1, -1, -1)
    exit()
f = True
while n:
    if n % 2 and f:
        a += p
        b += p
        f = False
    elif n % 2:
        a += p
        c += p
    n //= 2
    p *= 2

assert a | b == b | c == c | a and a ^ b ^ c == 0 and a > 0 and b > 0 and c > 0


print(a, b, c)
0