結果
| 問題 | No.683 Two Operations No.3 | 
| コンテスト | |
| ユーザー |  hanbei_dayo | 
| 提出日時 | 2020-09-03 11:31:39 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 2,000 ms | 
| コード長 | 902 bytes | 
| コンパイル時間 | 779 ms | 
| コンパイル使用メモリ | 83,772 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-11-23 01:04:40 | 
| 合計ジャッジ時間 | 1,487 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 16 | 
コンパイルメッセージ
main.cpp: In function 'bool dfs(ll, ll)':
main.cpp:41:1: warning: control reaches end of non-void function [-Wreturn-type]
   41 | }
      | ^
            
            ソースコード
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<functional>
#include<math.h>
using namespace std;
//#define N (1000000000+7)
//#define N (998244353)
#define N 17
#define INF 1e16
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<ll> vec;
typedef vector<vec> mat;
const int inf = 1e9;
bool dfs(ll A,ll B){
    if(A>B)swap(A,B);
    if(A==0 && B==0)return true;
    if(A==0)return true;
    if(A<0 || B<0)return false;
    if(A%2==1 && B%2==1){
        return false;
    }
    if(A%2==0 && B%2==1){
        return dfs(A/2,B-1);
    }
    if(A%2==1 && B%2==0){
        return dfs(A-1,B/2);
    }
    if(A%2==0 && B%2==0){
        return dfs(A/2,B-1)|dfs(A-1,B/2);
    }
}
int main(void){
    ll A,B;
    cin>>A>>B;
    if(dfs(A,B))cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}
 
            
            
            
        