結果

問題 No.643 Two Operations No.2
ユーザー konsin_tokagekonsin_tokage
提出日時 2018-03-08 18:41:21
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 288 bytes
コンパイル時間 233 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 10,624 KB
最終ジャッジ日時 2024-04-15 12:18:40
合計ジャッジ時間 1,436 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 32 ms
10,624 KB
testcase_01 AC 33 ms
10,624 KB
testcase_02 AC 31 ms
10,624 KB
testcase_03 AC 31 ms
10,624 KB
testcase_04 AC 31 ms
10,624 KB
testcase_05 AC 31 ms
10,496 KB
testcase_06 WA -
testcase_07 AC 31 ms
10,624 KB
testcase_08 WA -
testcase_09 AC 31 ms
10,624 KB
testcase_10 AC 31 ms
10,624 KB
testcase_11 AC 32 ms
10,624 KB
testcase_12 AC 32 ms
10,624 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

x, y = map(int, input().split())
dist = {}
que = [(0, x, y)]
for n, x, y in que:
    if -100<=x<=100 and -100<=y<=100 and (x, y) not in dist:
        if x == y:
            print(n)
            break
        dist[x, y] = n
        que += [(n+1, x+y, x-y), (n+1, y, x)]
else:
    print(-1)
0