結果

問題 No.3254 Xor, Max and Sum
ユーザー D M
提出日時 2025-09-09 11:01:50
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 501 bytes
コンパイル時間 5,845 ms
コンパイル使用メモリ 331,596 KB
実行使用メモリ 6,272 KB
最終ジャッジ日時 2025-09-09 11:01:58
合計ジャッジ時間 8,018 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 19 WA * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
using ll = long long;
const ll MOD = 998244353;
#include<atcoder/all>
using namespace atcoder;
using mint = modint998244353;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll n,m;cin>>n>>m;
  if(n%2==0){
    cout<<n*m<<endl;
    return 0;
  }
  ll cnt=0;
  while((1<<(cnt+1))<=m){
    cnt++;
  }
  cout<<m*(n-2)+((1<<cnt)-1)+(m^((1<<cnt)-1));
}
0