結果
| 問題 |
No.3254 Xor, Max and Sum
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-09-05 15:42:40 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 252 bytes |
| コンパイル時間 | 392 ms |
| コンパイル使用メモリ | 82,312 KB |
| 実行使用メモリ | 54,096 KB |
| 最終ジャッジ日時 | 2025-09-05 15:42:45 |
| 合計ジャッジ時間 | 4,339 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 25 WA * 23 |
ソースコード
N,M=map(int,input().split())
if N==1 : exit(print(0))
if N%2==0 : exit(print(N*M))
A=[]
for i in range(60):
if M>>i&1 : A.append(i)
ans=M*(N-1)
A.reverse()
if 2<=len(A):
for i in range(A[1],-1,-1):
if i not in A : ans+=1<<i+1
print(ans)