結果

問題 No.683 Two Operations No.3
コンテスト
ユーザー zelda_master
提出日時 2026-11-22 16:45:03
言語 C++14
(gcc 15.3.0 + boost 1.92.0 + ACL)
コンパイル:
g++-15 -O2 -fplugin=/usr/lib/yukicoder/noavx512-gcc15.so -lm -std=c++14 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 1 ms / 2,000 ms
+ 716µs
コード長 531 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 350 ms
コンパイル使用メモリ 77,836 KB
実行使用メモリ 9,908 KB
最終ジャッジ日時 2026-11-22 16:45:05
合計ジャッジ時間 1,817 ms
ジャッジサーバーID
(参考情報)
judge6_0 / judge4_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 16
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <iostream>
#include <cstdio>

using namespace std;

typedef long long LL;

bool DFS(LL x, LL y) {
    if (x == 0 || y == 0) return true;
    if (x % 2 == 0 && y % 2 == 0) {
        if (DFS(x / 2, y - 1)) return true;
        return DFS(x - 1, y / 2);
    } else if (x % 2 == 0) return DFS(x / 2, y - 1);
    else if (y % 2 == 0) return DFS(x - 1, y / 2);
    return false;
}

void Solve() {
    LL x, y;
    scanf("%lld%lld", &x, &y);
    
    puts(DFS(x, y) ? "Yes" : "No");
}

int main() {
    Solve();

    return 0;
}
0