結果

問題 No.683 Two Operations No.3
ユーザー furafura
提出日時 2020-05-13 04:32:30
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 784 bytes
コンパイル時間 3,855 ms
コンパイル使用メモリ 198,040 KB
実行使用メモリ 4,356 KB
最終ジャッジ日時 2023-10-12 10:28:32
合計ジャッジ時間 3,354 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

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

ソースコード

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