結果
問題 |
No.1957 Xor Min
|
ユーザー |
![]() |
提出日時 | 2022-05-28 00:45:25 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 910 bytes |
コンパイル時間 | 2,005 ms |
コンパイル使用メモリ | 191,836 KB |
最終ジャッジ日時 | 2025-01-29 16:28:48 |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 25 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll=long long; using ld=long double; ll inf=10010010010010010; ll mod=1000000007; int main(){ ll a,b; cin >> a >> b ; ll x=min(a,b); ll y=max(a,b); while (1) { x/=2; y/=2; if (x==0) { if (y!=0) { cout << min(a,b) << endl; return 0; } break; } } x=1; while (x<a&&x<b) { x*=2; } if (x==a||x==b) { if (a==b) { cout << x-1 << endl; }else if (max(a,b)>=x*2) { cout << x << endl; }else{ cout << x-1 << endl; } }else{ if (x-1==min(a,b)&&b!=a) { cout << x-1 << endl; return 0; } x/=2; x-=1; cout << x << endl; } }