結果

問題 No.489 株に挑戦
ユーザー mkawa2
提出日時 2020-05-16 16:15:00
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
TLE  
実行時間 -
コード長 1,259 bytes
コンパイル時間 394 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 80,416 KB
最終ジャッジ日時 2024-09-22 11:50:52
合計ジャッジ時間 25,989 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 32 WA * 2 TLE * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

import numpy as np
from itertools import *
from bisect import *
from collections import *
from heapq import *
import sys

sys.setrecursionlimit(10 ** 6)

def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def SI(): return sys.stdin.readline()[:-1]
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]
int1 = lambda x: int(x) - 1
def MI1(): return map(int1, sys.stdin.readline().split())
def LI1(): return list(map(int1, sys.stdin.readline().split()))
p2D = lambda x: print(*x, sep="\n")
dij = [(1, 0), (0, 1), (-1, 0), (0, -1)]

def main():
    ii=deque()
    xx=deque()
    n,d,k=MI()
    mx=0
    ai=aj=0
    for i in range(n):
        x=II()
        if i==0:
            ii.append(i)
            xx.append(x)
            continue
        if ii and ii[0]<i-d:
            ii.popleft()
            xx.popleft()
        cur=x-xx[0]
        if cur>mx:
            mx=cur
            ai=ii[0]
            aj=i
        while xx and xx[-1]>=x:
            ii.pop()
            xx.pop()
        xx.append(x)
        ii.append(i)

    print(mx*k)
    if mx:print(ai,aj)

main()
0