結果

問題 No.683 Two Operations No.3
ユーザー おおおきにおおおきに
提出日時 2018-05-12 00:47:57
言語 Rust
(1.77.0)
結果
MLE  
実行時間 -
コード長 711 bytes
コンパイル時間 577 ms
コンパイル使用メモリ 130,888 KB
実行使用メモリ 808,892 KB
最終ジャッジ日時 2023-09-10 18:13:05
合計ジャッジ時間 2,733 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 MLE -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

use std::io::{Read, stdin};

fn dfs(a: i64, b: i64) -> bool {
    if a == 0 && b == 0 {
        return true;
    }
    let mut ret = false;
    if (a & 1) == 0 && b != 0 {
        ret |= dfs(a >> 1, b - 1);
    }
    if !ret && (b & 1) == 0 && a != 0 {
        ret |= dfs(a - 1, b >> 1);
    }
    ret
}

fn main() {
    let mut buf = String::new();
    stdin().read_to_string(&mut buf).unwrap();
    let mut tok = buf.split_whitespace();
    let mut get = || tok.next().unwrap().parse::<i64>().unwrap();
    let a = get();
    let b = get();
    if a % 2 != 0 && b % 2 != 0 {
        println!("No");
        return;
    }
    if dfs(a, b) {
        println!("Yes");
    } else {
        println!("No");
    }
}
0