結果

問題 No.683 Two Operations No.3
ユーザー warabi0906warabi0906
提出日時 2023-02-10 14:27:00
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
MLE  
実行時間 -
コード長 1,828 bytes
コンパイル時間 3,820 ms
コンパイル使用メモリ 233,100 KB
実行使用メモリ 814,168 KB
最終ジャッジ日時 2023-09-21 17:26:26
合計ジャッジ時間 6,478 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,380 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>
#include "atcoder/all"
#define debug cout << "OK" << endl;
template<typename T>
inline bool chmax(T& a, const T b) { if (a < b) { a = b; return true; } return false; }
template<typename T>
inline bool chmin(T& a, const T b) { if (a > b) { a = b; return true; } return false; }
inline int Code(char c) {
	if ('A' <= c and c <= 'Z')return (int)(c - 'A');
	if ('a' <= c and c <= 'z')return (int)(c - 'a');
	if ('0' <= c and c <= '9')return (int)(c - '0');
	assert(false);
}
using namespace std;
using namespace atcoder;
#define int long long
constexpr int MOD = 998244353;
constexpr int INF = (1LL << 63);
using minit = modint998244353;

template<typename T>
ostream& operator << (ostream& st, const vector<T>& v) {
	for (const T value : v) {
		st << value << " ";
	}
	return st;
}
template<typename T>
istream& operator >> (istream& st, vector<T>& v) {
	for (T& value : v) {
		st >> value;
	}
	return st;
}

struct edge {
	int to, cost;
};

//

//

class Solver {
public:
	int T;
	Solver() :T(1) {}
	~Solver(){}
	void multi();
	void solve() const;
	void sp(int x)const;
};
void Solver::multi() {
	cin >> T;
	return;
}
void Solver::sp(const int x)const {
	cout << fixed << setprecision(x) << endl;
	return;
}

void Solver::solve() const {
	int A, B;
	cin >> A >> B;
	set<pair<int,int>> ng;
	function<void(int, int)> f = [&](int a, int b) {
		if (ng.count({ a,b }))return;
		if (a == 0 and b == 0) {
			cout << "Yes" << endl;
			exit(0);
		}
		if (a % 2 == 0)f(a / 2, b - 1);
		if (b % 2 == 0)f(a - 1, b / 2);
		ng.insert({ a,b });
		return;
	};
	f(A, B);
	cout << "No" << endl;
	return;
}

signed main() {
	Solver solver;
	//solver.multi();
	//solver.sp();
	for (int i = 0; i < solver.T; i++)
		solver.solve();
	return 0;
}

/*
* わらびのコードこーどすぺーす
 (σ・∀・)σゲッツ!!
*/
0