結果
問題 |
No.3254 Xor, Max and Sum
|
ユーザー |
![]() |
提出日時 | 2025-09-05 21:40:08 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 51 ms / 2,000 ms |
コード長 | 343 bytes |
コンパイル時間 | 476 ms |
コンパイル使用メモリ | 82,252 KB |
実行使用メモリ | 53,980 KB |
最終ジャッジ日時 | 2025-09-05 21:40:42 |
合計ジャッジ時間 | 3,714 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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)