結果
| 問題 | No.3088 XOR = SUM |
| コンテスト | |
| ユーザー |
norioc
|
| 提出日時 | 2025-05-27 21:46:40 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 474 bytes |
| 記録 | |
| コンパイル時間 | 594 ms |
| コンパイル使用メモリ | 82,820 KB |
| 実行使用メモリ | 77,604 KB |
| 最終ジャッジ日時 | 2025-05-27 21:47:03 |
| 合計ジャッジ時間 | 19,263 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 1 WA * 21 |
ソースコード
def bsr(x: int) -> int:
"""1 が立っている最上位ビットの位置を返す (0-indexed)"""
assert x != 0
return x.bit_length() - 1
def solve():
N = int(input())
if N == 0: return 0, 0
x1 = 1 << bsr(N)
y1 = N - x1
x2 = y2 = 0
if N ^ x1:
x2 = 1 << bsr(N ^ x1)
y2 = x2 - 1
if x1 * y1 > x2 * y2:
return x1, y1
return x2, y2
T = int(input())
for _ in range(T):
ans = solve()
print(*ans)
norioc