結果
問題 |
No.3254 Xor, Max and Sum
|
ユーザー |
![]() |
提出日時 | 2025-09-06 02:52:48 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 45 ms / 2,000 ms |
コード長 | 284 bytes |
コンパイル時間 | 473 ms |
コンパイル使用メモリ | 82,708 KB |
実行使用メモリ | 53,780 KB |
最終ジャッジ日時 | 2025-09-06 02:52:54 |
合計ジャッジ時間 | 4,339 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 48 |
ソースコード
N,M=map(int,input().split()) if N%2 == 0: print(N*M) exit() if N==1: print(0) exit() ans=0 free = 0 for i in range(30,-1,-1): d = 2**i if d&M: ans+=(N//2)*2*d free+=1 free = min(free, N) else: ans+=(free//2)*2*d print(ans)