結果

問題 No.643 Two Operations No.2
ユーザー convexineqconvexineq
提出日時 2021-03-03 19:49:23
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 36 ms / 2,000 ms
コード長 225 bytes
コンパイル時間 364 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 52,608 KB
最終ジャッジ日時 2024-10-03 08:27:02
合計ジャッジ時間 1,565 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

x,y = map(int,input().split())
q = [(x,y,0)]
ans = 10
while q:
    x,y,c = q.pop()
    if x==y: ans = min(ans,c)
    if c >= 10: continue
    q.append((x+y,x-y,c+1))
    q.append((x+y,y-x,c+2))
print(ans if ans != 10 else -1)
0