結果

問題 No.1298 OR XOR
コンテスト
ユーザー Shirotsume
提出日時 2023-02-17 20:02:39
言語 PyPy3
(7.3.23)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 69 ms / 2,000 ms
+ 565µs
コード長 533 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 217 ms
コンパイル使用メモリ 96,364 KB
実行使用メモリ 79,232 KB
最終ジャッジ日時 2026-08-18 13:23:06
合計ジャッジ時間 2,715 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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