結果

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

ソースコード

diff #

from itertools import combinations
N,M = list(map(int,input().split()))

if(N%2 == 0):
    print(M*N)
else:
    # のこりの3つで最大化
    A = [0,0,0]
    for i in range(30,-1,-1):
        if(A[1] + (1<<i) > M):continue
        A[0] += 1<<i
        A[1] += 1<<i
        A.sort()
    print(M*(N-3) + sum(A))
0