結果
問題 |
No.683 Two Operations No.3
|
ユーザー |
![]() |
提出日時 | 2018-05-12 09:28:46 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 576 bytes |
コンパイル時間 | 1,618 ms |
コンパイル使用メモリ | 172,476 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-28 09:58:11 |
合計ジャッジ時間 | 2,286 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 16 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main() { int64_t a, b; cin >> a >> b; queue<pair<int64_t, int64_t>> q; q.emplace(a, b); while (!q.empty()) { int64_t x = q.front().first, y = q.front().second; q.pop(); if (x == 0 || y == 0) { cout << "Yes" << endl; return 0; } if (x % 2 == 0) { q.emplace(x / 2, y - 1); } if (y % 2 == 0) { q.emplace(x - 1, y / 2); } } cout << "No" << endl; return 0; }