結果

問題 No.683 Two Operations No.3
コンテスト
ユーザー ldsyb
提出日時 2018-05-11 22:25:43
言語 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
結果
MLE  
実行時間 -
コード長 693 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,708 ms
コンパイル使用メモリ 188,012 KB
実行使用メモリ 566,472 KB
最終ジャッジ日時 2026-03-16 15:07:23
合計ジャッジ時間 49,895 ms
ジャッジサーバーID
(参考情報)
judge1_1 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 2 TLE * 3 MLE * 11
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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

int main()
{
    int64_t a, b;
    cin >> a >> b;
    set<pair<int64_t, int64_t>> st;
    st.insert({0, 0});
    while (!st.empty())
    {
        set<pair<int64_t, int64_t>> next;
        for (auto &p : st)
        {
            if (p.first == a && p.second == b)
            {
                cout << "Yes" << endl;
                return 0;
            }
            if (a < p.first || b < p.second)
            {
                continue;
            }
            next.insert({2 * p.first, p.second + 1});
            next.insert({p.first + 1, 2 * p.second});
        }
        swap(st, next);
    }
    cout << "No" << endl;
    return 0;
}
0