結果

問題 No.683 Two Operations No.3
ユーザー srup٩(๑`н´๑)۶srup٩(๑`н´๑)۶
提出日時 2018-06-09 14:23:54
言語 C++11
(gcc 11.4.0)
結果
MLE  
実行時間 -
コード長 597 bytes
コンパイル時間 2,998 ms
コンパイル使用メモリ 143,012 KB
実行使用メモリ 813,964 KB
最終ジャッジ日時 2023-09-13 01:52:10
合計ジャッジ時間 4,285 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,384 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,384 KB
testcase_03 AC 2 ms
4,384 KB
testcase_04 MLE -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)


bool dfs(ll a, ll b) {
	if (a == 0 && b == 0) return true;
	if (a < 0 || b < 0) return false;


	if (a % 2 == 1 && b % 2 == 0) return dfs(a - 1, b / 2);
	else if(a % 2 == 0 && b % 2 == 1) return dfs(a / 2, b - 1);
	else if (a % 2 == 0 && b % 2 == 0){
		return dfs(a - 1, b / 2) | dfs(a / 2, b - 1);
	}

	return false;
}
int main(int argc, char const *argv[])
{
	ll a, b; cin >> a >> b;
	printf("%s\n", dfs(a, b) ? "Yes" : "No");
	return 0;
}
0