結果

問題 No.683 Two Operations No.3
コンテスト
ユーザー ldsyb
提出日時 2018-05-11 22:56:48
言語 C++14
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=c++14 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
TLE  
実行時間 -
コード長 647 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,067 ms
コンパイル使用メモリ 186,572 KB
実行使用メモリ 1,309,116 KB
最終ジャッジ日時 2026-03-16 21:33:08
合計ジャッジ時間 5,915 ms
ジャッジサーバーID
(参考情報)
judge3_1 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 7 TLE * 1 MLE * 2 -- * 6
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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

int main()
{
    int64_t a, b;
    cin >> a >> b;
    stack<pair<int64_t, int64_t>> st;
    st.push({a, b});
    while (!st.empty())
    {
        int64_t x = st.top().first, y = st.top().second;
        st.pop();
        if (x < 0 || y < 0)
        {
            continue;
        }
        if (x == 0 && y == 0)
        {
            cout << "Yes" << endl;
            return 0;
        }
        if (x % 2 == 0)
        {
            st.push({x / 2, y - 1});
        }
        if (y % 2 == 0)
        {
            st.push({x - 1, y / 2});
        }
    }
    cout << "No" << endl;
    return 0;
}
0