結果

問題 No.3254 Xor, Max and Sum
ユーザー tau1235
提出日時 2025-09-05 22:01:07
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 276 bytes
コンパイル時間 3,002 ms
コンパイル使用メモリ 275,492 KB
実行使用メモリ 7,720 KB
最終ジャッジ日時 2025-09-05 22:01:29
合計ジャッジ時間 4,564 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 19 WA * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;

int main(){
  using ll=long long;
  ll n,m;
  cin>>n>>m;
  ll ans=0;
  if (n%2==0) ans=n*m;
  else{
    ll top=1;
    while (top*2<=m) top*=2;
    ans+=(top*2-1)-(m-top);
    ans+=(n-2)*m;
    ans+=top-1;
  }
  cout<<ans<<endl;
}
0