結果

問題 No.683 Two Operations No.3
ユーザー fura
提出日時 2020-05-13 04:32:30
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 784 bytes
コンパイル時間 2,654 ms
コンパイル使用メモリ 191,116 KB
最終ジャッジ日時 2025-01-10 10:45:13
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

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

using namespace std;
using lint=long long;

bool dfs(lint x,lint y){
	if(x==0 || y==0) return true;
	if(x%2==1 && y%2==1) return false;
	if(x%2==1) return dfs(x-1,y/2);
	if(y%2==1) return dfs(x/2,y-1);
	return dfs(x-1,y/2) || dfs(x/2,y-1);
}

int main(){
	lint x,y; cin>>x>>y;
	puts(dfs(x,y)?"Yes":"No");
/*
	bool vis[50][50]={};
	vis[0][0]=true;
	queue<pair<int,int>> Q; Q.emplace(0,0);
	while(!Q.empty()){
		int y,x; tie(y,x)=Q.front(); Q.pop();
		if(y+1<50 && 2*x<50 && !vis[y+1][2*x]) vis[y+1][2*x]=true, Q.emplace(y+1,2*x);
		if(2*y<50 && x+1<50 && !vis[2*y][x+1]) vis[2*y][x+1]=true, Q.emplace(2*y,x+1);
	}
	rep(i,50){
		printf("%2d: ",i);
		rep(j,50) putchar(vis[i][j]?'#':'.');
		puts("");
	}
*/
	return 0;
}
0