結果
| 問題 | No.683 Two Operations No.3 |
| コンテスト | |
| ユーザー |
xxxasdfghjk
|
| 提出日時 | 2018-08-13 14:42:31 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 843 bytes |
| 記録 | |
| コンパイル時間 | 611 ms |
| コンパイル使用メモリ | 72,056 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-09-24 08:00:54 |
| 合計ジャッジ時間 | 1,248 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 16 |
ソースコード
#include<cstdio>
#include<queue>
#include<utility>
#include<cstring>
#include<stack>
#include<algorithm>
#include<cmath>
#include<iostream>
#include<map>
#define MAX_N 100001
#define INF_INT 2147483647
#define INF_LL 9223372036854775807
#define REP(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> P;
bool solve(ll A,ll B){
if(A == 0 || B == 0)
return true;
else if(A % 2 == 1 && B % 2 == 1)
return false;
else{
if(A % 2 == 0 && B % 2 == 0){
return solve(A/2,B-1) || solve(A-1,B/2);
}else{
if(A % 2 == 1)
return solve(A-1,B/2);
else
return solve(A/2,B-1);
}
}
}
int main()
{
ll A,B;
cin >> A >> B;
if(B > A)
swap(A,B);
if(solve(A,B)){
cout << "Yes" << endl;
}else
cout << "No" << endl;
return 0;
}
xxxasdfghjk