結果

問題 No.1957 Xor Min
ユーザー leeh18
提出日時 2022-05-28 12:26:46
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 462 bytes
コンパイル時間 2,024 ms
コンパイル使用メモリ 192,620 KB
最終ジャッジ日時 2025-01-29 16:43:39
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;

signed main() {
    cin.tie(0)->sync_with_stdio(0);
    cin.exceptions(cin.failbit);
    unsigned x, y;
    cin >> x >> y;
    if (__builtin_clz(x) > __builtin_clz(y)) {
        swap(x, y);
    }
    unsigned ans = 0;
    if (__builtin_clz(x) == __builtin_clz(y)) {
        ans = (1 << (31 - __builtin_clz(y))) - 1;
    } else {
        ans = y;
    }
    cout << ans << '\n';
    return 0;
}
0