結果

問題 No.3254 Xor, Max and Sum
ユーザー nikoro256
提出日時 2025-09-06 02:46:51
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 237 bytes
コンパイル時間 178 ms
コンパイル使用メモリ 82,752 KB
実行使用メモリ 53,920 KB
最終ジャッジ日時 2025-09-06 02:46:57
合計ジャッジ時間 3,869 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 45 WA * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M=map(int,input().split())
if N%2 == 0:
    print(N*M)
    exit()
ans=0
free = 0
for i in range(M.bit_length()-1,-1,-1):
    d = 2**i
    if d&M:
        ans+=(N//2)*2*d
        free+=1
    else:
        ans+=(free//2)*2*d
print(ans)

0