結果
| 問題 | No.3254 Xor, Max and Sum |
| コンテスト | |
| ユーザー |
detteiuu
|
| 提出日時 | 2025-09-05 21:40:08 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 66 ms / 2,000 ms |
| + 243µs | |
| コード長 | 343 bytes |
| 記録 | |
| コンパイル時間 | 253 ms |
| コンパイル使用メモリ | 96,232 KB |
| 実行使用メモリ | 79,144 KB |
| 最終ジャッジ日時 | 2026-07-14 15:07:15 |
| 合計ジャッジ時間 | 5,761 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 48 |
ソースコード
N, M = map(int, input().split())
ans = 0
small = [N, 0]
for i in reversed(range(30)):
if 1<<i & M:
if N%2 == 0:
ans += (1<<i)*N
else:
ans += (1<<i)*(N-1)
if small[0]:
small[0] -= 1
small[1] += 1
else:
ans += (1<<i)*(small[1]//2*2)
print(ans)
detteiuu