結果

問題 No.683 Two Operations No.3
ユーザー 👑 jupirojupiro
提出日時 2020-03-11 20:20:37
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,668 bytes
コンパイル時間 1,072 ms
コンパイル使用メモリ 111,300 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-10 01:39:31
合計ジャッジ時間 2,084 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include <cstdio>
#include <iostream>
#include <string>
#include <sstream>
#include <stack>
#include <algorithm>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
#include <tuple>
#include <assert.h>
#include <deque>
#include <bitset>
#include <iomanip>
#include <limits>
#include <chrono>
#include <random>
#include <array>
#include <unordered_map>
#include <functional>
#include <complex>

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

constexpr long long MAX = 5100000;
constexpr long long INF = 1LL << 60;
constexpr int inf = 1 << 28;
constexpr long long mod = 1000000007LL;
//constexpr long long mod = 998244353LL;

using namespace std;
typedef unsigned long long ull;
typedef long long ll;

ll A, B;
bool dfs(ll X, ll Y) {
	if (X > Y) swap(X, Y);
	if (X == 0 && Y == 0) return true;
	//if (mp.find({ X, Y }) != mp.end()) return mp[make_pair(X, Y)];
	if (X % 2 == 1 && Y % 2 == 1) {
		return false;
	}
	bool flag = false;
	if (X % 2 == 0 && Y > 0) {
		flag |= dfs(X / 2, Y - 1);
	}
	if (flag) true;
	if (X > 0 && Y % 2 == 0) {
		flag |= dfs(X - 1, Y / 2);
	}
	return flag;
}
int main()
{
	/*
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	*/
	scanf("%lld %lld", &A, &B);
	if (A == 0 || B == 0) {
		puts("Yes");
		return 0;
	}
	if (A > B) swap(A, B);
	bool flag = false;
	flag |= dfs(0, 1);
	flag |= dfs(1, 0);
	if (flag) puts("Yes");
	else puts("No");
	return 0;
	/*
		おまじないを使ったらscanfとprintf関連注意!!!!!!!!!!!!
	*/
}
0