結果
問題 | No.683 Two Operations No.3 |
ユーザー |
![]() |
提出日時 | 2018-05-12 00:13:39 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 501 bytes |
コンパイル時間 | 665 ms |
コンパイル使用メモリ | 74,224 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-28 09:57:04 |
合計ジャッジ時間 | 1,375 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 16 |
ソースコード
#include <iostream> #include <vector> #include <string> #include <algorithm> #include <cstdio> #include <cstring> #include <cmath> using namespace std; using ll = long long; int dfs(ll a, ll b) { if (a > b) swap(a, b); if (a == 0) return 1; for (int i = 0; i < 2; i++) { if (a % 2 == 0 && b > 0 && dfs(a / 2, b - 1)) return 1; swap(a, b); } return 0; } int main() { ll a, b; cin >> a >> b; cout << (dfs(a, b) ? "Yes" : "No") << endl; return 0; }