結果

問題 No.489 株に挑戦
ユーザー hedwig100hedwig100
提出日時 2020-06-05 20:42:23
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 655 bytes
コンパイル時間 296 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 23,680 KB
最終ジャッジ日時 2024-12-16 09:50:32
合計ジャッジ時間 5,469 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 29 WA * 6
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
sys.setrecursionlimit(10000000)
MOD = 10 ** 9 + 7
INF = 10 ** 15

from collections import deque,defaultdict,Counter
def main():
    N,D,K = map(int,input().split())
    X = [int(input()) for _ in range(N)]

    ans = 0
    L,R = -1,-1
    q = deque([])
    for i in range(N):
        if q and q[0][1] < i - D:
            q.popleft()
        if q and X[i] - q[-1][0] > ans:
            ans = X[i] - q[-1][0]
            L = q[-1][1]
            R = i
        if (not q) or (q[-1][0] >= X[i]):
            q.append((X[i],i))
    if L < 0:
        print(0)
    else:
        print(ans * K)
        print(L,R)
if __name__ == '__main__':
    main()
0