結果

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

ソースコード

diff #

#include<bits/stdc++.h>
#if __has_include(<atcoder/all>)
#endif
using namespace std;
#define done(...) return pp(__VA_ARGS__)
#define LL(...) ll __VA_ARGS__;lin(__VA_ARGS__)
#define of(i,...) for(auto[i,i##stop,i##step]=for_range<ll>(1,__VA_ARGS__);i>=i##stop;i+=i##step)
#define defpp template<ostream&o=cout>void pp(const auto&...a){[[maybe_unused]]const char*c="";((o<<c<<a,c=" "),...);o<<'\n';}void epp(const auto&...a){pp<cerr>(a...);}
#define entry defpp void main();void main2();}int main(){my::io();my::main();}namespace my{
namespace my{
void io(){cin.tie(nullptr)->sync_with_stdio(0);cout<<fixed<<setprecision(15);}
using ll=long long;
template<class T>constexpr auto for_range(T s,T b){T a=0;if(s)swap(a,b);return array{a-s,b,1-s*2};}
void lin(auto&...a){(cin>>...>>a);}
constexpr auto even(auto x){return~x&1;}
template<class T=ll>T pow2(ll n){return T(1)<<n;}
constexpr ll size2(auto x){x|=1;ll r=0;while(x>0)x>>=1,++r;return r;}
constexpr auto at2(auto x,auto i){return x>>i&1;}
}
namespace my{entry
void main(){
  LL(N,M);

  if(even(N))done(N*M);

  N=N/2*2;

  ll ans=0;
  ll free=0;
  of(b,size2(M)){
    if(at2(M,b)){
      ans+=pow2(b)*N;
      free++;
    }
    else{
      ans+=pow2(b)*(free/2*2);
    }
  }
  pp(ans);
}}
0