結果
問題 | No.1298 OR XOR |
ユーザー | Shirotsume |
提出日時 | 2023-02-17 20:02:39 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 44 ms / 2,000 ms |
コード長 | 533 bytes |
コンパイル時間 | 200 ms |
コンパイル使用メモリ | 82,048 KB |
実行使用メモリ | 53,888 KB |
最終ジャッジ日時 | 2024-07-19 11:24:19 |
合計ジャッジ時間 | 1,790 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 13 |
ソースコード
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)