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