結果

問題 No.489 株に挑戦
ユーザー mkawa2mkawa2
提出日時 2020-05-16 16:15:00
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
TLE  
実行時間 -
コード長 1,259 bytes
コンパイル時間 218 ms
コンパイル使用メモリ 12,104 KB
実行使用メモリ 71,096 KB
最終ジャッジ日時 2023-10-23 17:58:45
合計ジャッジ時間 5,808 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 AC 525 ms
42,856 KB
testcase_02 AC 481 ms
42,856 KB
testcase_03 AC 490 ms
42,856 KB
testcase_04 AC 495 ms
42,856 KB
testcase_05 AC 498 ms
42,856 KB
testcase_06 AC 490 ms
42,856 KB
testcase_07 AC 492 ms
42,856 KB
testcase_08 AC 493 ms
42,856 KB
testcase_09 AC 487 ms
42,856 KB
testcase_10 AC 487 ms
42,856 KB
testcase_11 AC 498 ms
42,856 KB
testcase_12 AC 491 ms
42,856 KB
testcase_13 AC 484 ms
42,856 KB
testcase_14 AC 494 ms
42,856 KB
testcase_15 AC 501 ms
42,856 KB
testcase_16 AC 548 ms
42,856 KB
testcase_17 AC 498 ms
42,856 KB
testcase_18 AC 528 ms
42,856 KB
testcase_19 AC 516 ms
42,856 KB
testcase_20 AC 546 ms
42,856 KB
testcase_21 AC 501 ms
42,856 KB
testcase_22 AC 494 ms
42,856 KB
testcase_23 AC 527 ms
42,856 KB
testcase_24 AC 573 ms
42,856 KB
testcase_25 AC 486 ms
42,856 KB
testcase_26 AC 550 ms
42,856 KB
testcase_27 WA -
testcase_28 AC 493 ms
42,856 KB
testcase_29 AC 500 ms
42,856 KB
testcase_30 AC 558 ms
42,856 KB
testcase_31 AC 558 ms
48,140 KB
testcase_32 AC 533 ms
42,856 KB
testcase_33 AC 554 ms
42,856 KB
testcase_34 AC 549 ms
42,856 KB
testcase_35 AC 510 ms
42,856 KB
testcase_36 AC 502 ms
42,856 KB
testcase_37 WA -
権限があれば一括ダウンロードができます

ソースコード

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