結果
問題 | No.683 Two Operations No.3 |
ユーザー | None |
提出日時 | 2021-03-05 20:19:52 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 42 ms / 2,000 ms |
コード長 | 591 bytes |
コンパイル時間 | 263 ms |
コンパイル使用メモリ | 82,292 KB |
実行使用メモリ | 52,608 KB |
最終ジャッジ日時 | 2024-04-16 07:57:04 |
合計ジャッジ時間 | 1,839 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 41 ms
52,352 KB |
testcase_01 | AC | 39 ms
52,208 KB |
testcase_02 | AC | 40 ms
52,096 KB |
testcase_03 | AC | 40 ms
52,224 KB |
testcase_04 | AC | 39 ms
52,224 KB |
testcase_05 | AC | 41 ms
52,224 KB |
testcase_06 | AC | 42 ms
52,480 KB |
testcase_07 | AC | 39 ms
52,096 KB |
testcase_08 | AC | 39 ms
52,608 KB |
testcase_09 | AC | 41 ms
52,480 KB |
testcase_10 | AC | 40 ms
51,968 KB |
testcase_11 | AC | 39 ms
52,224 KB |
testcase_12 | AC | 40 ms
52,480 KB |
testcase_13 | AC | 40 ms
52,388 KB |
testcase_14 | AC | 41 ms
51,712 KB |
testcase_15 | AC | 39 ms
52,352 KB |
ソースコード
def dfs(start=0,goal=None): parents={} p,t=start,0 parents[p]=-2 next_set=[(p,t)] if p==goal: return t while next_set: p,t=next_set.pop() for q in make_edges(p): if q in parents: continue if q[0]==0 or q[1]==0: return 1 parents[q]=p next_set.append((q,t+1)) return 0 def make_edges(p): a,b=p if a%2==0: yield a//2, b-1 if b%2==0: yield a-1, b//2 A,B=map(int, input().split()) res=dfs(start=(A,B)) print("Yes" if res else "No")