結果
問題 |
No.3254 Xor, Max and Sum
|
ユーザー |
![]() |
提出日時 | 2025-09-20 04:27:13 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 717 bytes |
コンパイル時間 | 2,509 ms |
コンパイル使用メモリ | 275,752 KB |
実行使用メモリ | 7,720 KB |
最終ジャッジ日時 | 2025-09-20 04:27:18 |
合計ジャッジ時間 | 4,357 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 19 WA * 29 |
ソースコード
//#include <monsterenergy> #include <bits/stdc++.h> using namespace std; typedef long long ll; #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() const int MAX = 1e9; const int MIN = -1*1e9; const ll MAXLL = 1e18; const ll MINLL = -1*1e18; int main() { ll N,M; cin >> N >> M; if(N%2 == 0) { cout << N*M << endl; return 0; } ll Ans = (N-1)*M, P = 0, Hanten = 0; bool f = false; for(ll i = 0; i < 60; i++) { if((1LL<<i) <= M) { if(!f) f = true, P = (1LL<<i); if((!(M&(1LL<<i)))) Ans += (1LL<<i)*2, Hanten += (1LL<<i); } } cout << (P+(~M) <= M ? Ans : (N-1)*M) << endl; return 0; }