結果

問題 No.489 株に挑戦
ユーザー maspymaspy
提出日時 2020-03-13 18:43:29
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 105 ms / 1,000 ms
コード長 672 bytes
コンパイル時間 79 ms
コンパイル使用メモリ 10,904 KB
実行使用メモリ 17,948 KB
最終ジャッジ日時 2023-09-27 06:07:43
合計ジャッジ時間 3,476 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 80 ms
15,420 KB
testcase_01 AC 60 ms
13,432 KB
testcase_02 AC 19 ms
8,520 KB
testcase_03 AC 20 ms
8,608 KB
testcase_04 AC 19 ms
8,472 KB
testcase_05 AC 20 ms
8,616 KB
testcase_06 AC 19 ms
8,488 KB
testcase_07 AC 19 ms
8,564 KB
testcase_08 AC 19 ms
8,552 KB
testcase_09 AC 19 ms
8,568 KB
testcase_10 AC 20 ms
8,528 KB
testcase_11 AC 19 ms
8,480 KB
testcase_12 AC 19 ms
8,644 KB
testcase_13 AC 19 ms
8,648 KB
testcase_14 AC 20 ms
8,528 KB
testcase_15 AC 23 ms
8,984 KB
testcase_16 AC 89 ms
16,216 KB
testcase_17 AC 30 ms
9,892 KB
testcase_18 AC 58 ms
13,124 KB
testcase_19 AC 51 ms
12,096 KB
testcase_20 AC 90 ms
16,584 KB
testcase_21 AC 37 ms
10,444 KB
testcase_22 AC 25 ms
9,268 KB
testcase_23 AC 62 ms
13,744 KB
testcase_24 AC 101 ms
17,908 KB
testcase_25 AC 19 ms
8,520 KB
testcase_26 AC 92 ms
17,936 KB
testcase_27 AC 99 ms
17,804 KB
testcase_28 AC 19 ms
8,612 KB
testcase_29 AC 19 ms
8,480 KB
testcase_30 AC 102 ms
17,948 KB
testcase_31 AC 105 ms
17,896 KB
testcase_32 AC 63 ms
13,800 KB
testcase_33 AC 97 ms
17,320 KB
testcase_34 AC 88 ms
16,192 KB
testcase_35 AC 47 ms
11,660 KB
testcase_36 AC 30 ms
9,744 KB
testcase_37 AC 62 ms
13,740 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3.8
# %%
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from collections import deque

# %%
N, D, K, *X = map(int, read().split())

# %%


def gen_cand():
    q = deque([0])
    for k, x in enumerate(X[1:], 1):
        while q[0] < k - D:
            q.popleft()
        j = q[0]
        diff = x - X[j]
        yield j, k, diff
        while q and X[q[-1]] > x:
            q.pop()
        q.append(k)


# %%
best = 0, 0, 0
for j, k, x in gen_cand():
    if best[2] < x:
        best = j, k, x
if best[2] == 0:
    print(0)
else:
    print(best[2] * K)
    print(best[0], best[1])
0