結果

問題 No.683 Two Operations No.3
ユーザー hiro71687k
提出日時 2023-03-31 03:56:24
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 26 ms / 2,000 ms
コード長 758 bytes
コンパイル時間 3,979 ms
コンパイル使用メモリ 255,176 KB
最終ジャッジ日時 2025-02-11 19:27:41
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll=long long;
using ld=long double;
ld pie=3.141592653589793;
ll mod=1000000007;
ll inf=999999999999999999;
int main(){
    ll x,y;
    cin >> x >> y;
    queue<pair<ll,ll>>que;
    que.push({x,y});
    while (!que.empty())
    {
        ll a=que.front().first;
        ll b=que.front().second;
        que.pop();
        if (a==0||b==0)
        {
            cout << "Yes" << endl;
            return 0;
        }
        if (a%2&&b%2)
        {
            continue;
        }
        if (a%2==0)
        {
            que.push({a/2,b-1});
        }
        if (b%2==0)
        {
            que.push({a-1,b/2});
        }
    }
    cout << "No" << endl;
}
0