結果

問題 No.1957 Xor Min
ユーザー 👑 jupirojupiro
提出日時 2022-05-27 21:32:31
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,243 bytes
コンパイル時間 2,095 ms
コンパイル使用メモリ 201,956 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-20 19:56:41
合計ジャッジ時間 2,840 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 2 ms
4,348 KB
testcase_12 AC 2 ms
4,348 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 2 ms
4,348 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 2 ms
4,348 KB
testcase_20 AC 2 ms
4,348 KB
testcase_21 AC 2 ms
4,348 KB
testcase_22 AC 2 ms
4,348 KB
testcase_23 AC 2 ms
4,348 KB
testcase_24 AC 2 ms
4,348 KB
testcase_25 AC 2 ms
4,348 KB
testcase_26 WA -
testcase_27 AC 2 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}
0