結果

問題 No.683 Two Operations No.3
ユーザー 👑 jupirojupiro
提出日時 2020-03-11 20:12:49
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
MLE  
実行時間 -
コード長 1,597 bytes
コンパイル時間 1,129 ms
コンパイル使用メモリ 120,544 KB
実行使用メモリ 813,368 KB
最終ジャッジ日時 2023-08-10 01:39:22
合計ジャッジ時間 4,225 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

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