結果

問題 No.489 株に挑戦
ユーザー tnishinagatnishinaga
提出日時 2017-02-27 04:27:05
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 1,004 bytes
コンパイル時間 121 ms
コンパイル使用メモリ 10,984 KB
実行使用メモリ 26,780 KB
最終ジャッジ日時 2023-09-02 11:10:46
合計ジャッジ時間 14,125 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 AC 643 ms
15,264 KB
testcase_02 AC 16 ms
8,192 KB
testcase_03 AC 16 ms
8,328 KB
testcase_04 AC 16 ms
8,420 KB
testcase_05 AC 17 ms
8,256 KB
testcase_06 AC 16 ms
8,228 KB
testcase_07 AC 17 ms
8,392 KB
testcase_08 AC 17 ms
8,184 KB
testcase_09 AC 17 ms
8,276 KB
testcase_10 AC 17 ms
8,336 KB
testcase_11 AC 16 ms
8,264 KB
testcase_12 AC 16 ms
8,248 KB
testcase_13 AC 16 ms
8,252 KB
testcase_14 AC 16 ms
8,204 KB
testcase_15 AC 40 ms
9,052 KB
testcase_16 TLE -
testcase_17 AC 69 ms
8,688 KB
testcase_18 AC 655 ms
15,664 KB
testcase_19 AC 455 ms
13,584 KB
testcase_20 TLE -
testcase_21 AC 172 ms
11,156 KB
testcase_22 AC 54 ms
9,520 KB
testcase_23 TLE -
testcase_24 TLE -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import bisect

def problem_input():
    ndk = input().split()
    n = int(ndk[0], 10)
    d = int(ndk[1], 10)
    k = int(ndk[2], 10)
    xlist = [int(input(), 10) for i in range(n)]
    return n, d, k, xlist

def test_input():
    n = 7
    d = 2
    k = 1000
    xlist = [1,3,5,1,4,4,7]
    return n, d, k, xlist

def test_input1():
    n = 5
    d = 4
    k = 100
    xlist = [1,2,1,2,1]
    return n, d, k, xlist

def test_input2():
    n = 5
    d = 1
    k = 100
    xlist = [5,4,3,3,1]
    return n, d, k, xlist

# main
n,d,k,xlist = problem_input()
# n,d,k,xlist = test_input1()

sorted_list = [(xlist[0], 0)]
diff_max = 0
for i in range(1, n):
    while (i - sorted_list[0][1]) > d:
        sorted_list = sorted_list[1:]
    if diff_max < (xlist[i] - sorted_list[0][0]):
        diff_max = xlist[i] - sorted_list[0][0]
        result = (sorted_list[0][1], i)
    bisect.insort(sorted_list, (xlist[i], i))


print(diff_max * k)
if diff_max != 0:
    print("{0} {1}".format(result[0], result[1]))
0