結果
問題 |
No.3254 Xor, Max and Sum
|
ユーザー |
![]() |
提出日時 | 2025-09-05 22:10:15 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 341 bytes |
コンパイル時間 | 317 ms |
コンパイル使用メモリ | 82,836 KB |
実行使用メモリ | 54,264 KB |
最終ジャッジ日時 | 2025-09-05 22:10:44 |
合計ジャッジ時間 | 3,751 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 25 WA * 23 |
ソースコード
from itertools import combinations N,M = list(map(int,input().split())) if(N == 1): print(0) elif(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))