結果
| 問題 |
No.683 Two Operations No.3
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-03-11 20:19:41 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
MLE
|
| 実行時間 | - |
| コード長 | 1,749 bytes |
| コンパイル時間 | 2,423 ms |
| コンパイル使用メモリ | 121,828 KB |
| 実行使用メモリ | 814,848 KB |
| 最終ジャッジ日時 | 2024-11-16 00:22:30 |
| 合計ジャッジ時間 | 8,761 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 12 MLE * 4 |
ソースコード
#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 (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) return mp[{X, Y}] = true;
if (X > 0 && Y % 2 == 0) {
flag |= dfs(X - 1, Y / 2);
}
if (flag) return mp[{X, Y}] = true;
else return mp[{X, Y}] = false;
}
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(A, B);
if (flag) puts("Yes");
else puts("No");
return 0;
/*
おまじないを使ったらscanfとprintf関連注意!!!!!!!!!!!!
*/
}