結果
| 問題 |
No.683 Two Operations No.3
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-12-25 15:03:19 |
| 言語 | Rust (1.83.0 + proconio) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 961 bytes |
| コンパイル時間 | 12,990 ms |
| コンパイル使用メモリ | 383,840 KB |
| 実行使用メモリ | 13,640 KB |
| 最終ジャッジ日時 | 2024-11-19 03:50:25 |
| 合計ジャッジ時間 | 28,849 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 11 TLE * 5 |
ソースコード
use std::collections::VecDeque;
fn main() {
let mut ab = String::new();
std::io::stdin().read_line(&mut ab).ok();
let ab: Vec<usize> = ab.trim().split_whitespace().map(|s| s.parse().unwrap()).collect();
let a = ab[0];
let b = ab[1];
if a == 0 && b == 0 {
println!("Yes");
return;
}
let mut deque = VecDeque::new();
deque.push_back((a, b));
while let Some((x, y)) = deque.pop_front() {
if x % 2 == 0 && y > 0 {
let nx = x / 2;
let ny = y - 1;
if nx == 0 && ny == 0 {
println!("Yes");
return;
}
deque.push_back((nx, ny));
}
if x > 0 && y % 2 == 0 {
let nx = x - 1;
let ny = y / 2;
if nx == 0 && ny == 0 {
println!("Yes");
return;
}
deque.push_back((nx, ny));
}
}
println!("No");
}