結果
問題 |
No.683 Two Operations No.3
|
ユーザー |
![]() |
提出日時 | 2018-05-11 22:30:05 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 1,026 bytes |
コンパイル時間 | 696 ms |
コンパイル使用メモリ | 80,256 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-28 09:53:49 |
合計ジャッジ時間 | 1,300 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 16 |
ソースコード
#include <iostream> #include <vector> #include <string> #include <cmath> #include <algorithm> #include <utility> #include <queue> #include <set> #include <map> #include <iomanip> #include <cstdio> using namespace std; typedef long long ll; typedef pair<int,int> PII; typedef vector<int> VI; typedef vector<VI> VVI; #define MP make_pair #define PB push_back #define inf 1000000007 #define rep(i,n) for(int i=0;i<(int)(n);++i) template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val){ std::fill( (T*)array, (T*)(array+N), val ); } bool bfs(ll a, ll b){ if(a==0||b==0){ return true; } if(a%2!=0&&b%2!=0){ return false; } bool flag1 = 0; if(a%2==0){ flag1= bfs(a/2,b-1); } if(flag1){ return true; } if(b%2==0){ flag1 = bfs(a-1,b/2); } return flag1; } int main(){ ll a,b; cin >> a >> b; if(bfs(a,b)){ cout << "Yes" << endl; }else{ cout << "No" << endl; } return 0; }