結果
| 問題 |
No.1957 Xor Min
|
| ユーザー |
|
| 提出日時 | 2022-05-27 21:32:31 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,243 bytes |
| コンパイル時間 | 1,991 ms |
| コンパイル使用メモリ | 193,640 KB |
| 最終ジャッジ日時 | 2025-01-29 15:49:10 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 15 WA * 10 |
ソースコード
#include <bits/stdc++.h>
using std::cin;
using std::cout;
using std::endl;
std::mt19937 rnd(std::chrono::steady_clock::now().time_since_epoch().count());
template <class T> inline bool chmax(T &a, T b) {
if (a < b) {
a = b;
return 1;
}
return 0;
}
template <class T> inline bool chmin(T &a, T b) {
if (a > b) {
a = b;
return 1;
}
return 0;
}
const int inf = (int)1e9 + 7;
const long long INF = 1LL << 60;
void solve() {
int A, B;
cin >> A >> B;
if (A == 0 or B == 0) {
cout << 0 << "\n";
return;
}
int msb_a = -1, msb_b = -1;
{
for (int i = 0; i < 30; i++) {
if (A >> i & 1) {
msb_a = i;
}
}
{
for (int i = 0; i < 30; i++) {
if (B >> i & 1) {
msb_b = i;
}
}
}
}
cout << (1 << std::max(msb_a, msb_b)) - 1 << "\n";
}
int main() {
std::cin.tie(nullptr);
std::ios::sync_with_stdio(false);
int I_love_KKT89 = 1;
// cin >> I_love_KKT89;
for (int Case = 1; Case <= I_love_KKT89; ++Case) {
// cout << "Case #" << Case << ": ";
solve();
}
return 0;
}