結果

問題 No.602 隠されていたゲーム2
ユーザー GrayCoderGrayCoder
提出日時 2017-12-02 01:38:08
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 526 bytes
コンパイル時間 606 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 16,256 KB
最終ジャッジ日時 2024-05-06 00:35:52
合計ジャッジ時間 4,694 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 28 ms
10,880 KB
testcase_01 AC 25 ms
10,880 KB
testcase_02 AC 25 ms
10,752 KB
testcase_03 AC 26 ms
10,880 KB
testcase_04 AC 27 ms
10,752 KB
testcase_05 WA -
testcase_06 AC 25 ms
10,880 KB
testcase_07 WA -
testcase_08 RE -
testcase_09 WA -
testcase_10 TLE -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

from bisect import bisect

def main():
    N = int(input())
    D = tuple(map(int, input().split()))
    X, Y = map(int, input().split())

    p = abs(X) + abs(Y)
    if N == 1:
        if p % D[0]:
            print(-1)
        else:
            print(p // D[0])
        return

    n = 1
    while 1:
        prev = p
        if p in D:
            print(n)
            break
        x = bisect(D, p)
        p = abs(p - min(D[x-1], D[x]))
        if p > prev:
            print(-1)
            break
        n += 1

main()
0