結果

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

ソースコード

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)
        {
            a-=1;
            b/=2;
            que.push({a,b});
        }else if (b%2)
        {
            b-=1;
            a/=2;
            que.push({a,b});
        }else{
            if ((a/2)%2)
            {
                a-=1;
                b/=2;
                que.push({a,b});
            }else if ((b/2)%2)
            {
                b-=1;
                a/=2;
                que.push({a,b});
            }else{
                a-=1;
                b/=2;
                que.push({a,b});
            }
        }
    }
    cout << "No" << endl;
}
0