結果

問題 No.489 株に挑戦
ユーザー mkawa2mkawa2
提出日時 2020-05-16 17:42:46
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 93 ms / 1,000 ms
コード長 753 bytes
コンパイル時間 89 ms
コンパイル使用メモリ 10,928 KB
実行使用メモリ 17,148 KB
最終ジャッジ日時 2023-09-27 06:08:13
合計ジャッジ時間 3,235 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
11,576 KB
testcase_01 AC 55 ms
10,348 KB
testcase_02 AC 17 ms
8,524 KB
testcase_03 AC 18 ms
8,580 KB
testcase_04 AC 17 ms
8,656 KB
testcase_05 AC 18 ms
8,672 KB
testcase_06 AC 18 ms
8,664 KB
testcase_07 AC 17 ms
8,668 KB
testcase_08 AC 18 ms
8,532 KB
testcase_09 AC 17 ms
8,548 KB
testcase_10 AC 17 ms
8,532 KB
testcase_11 AC 18 ms
8,636 KB
testcase_12 AC 18 ms
8,644 KB
testcase_13 AC 17 ms
8,632 KB
testcase_14 AC 17 ms
8,636 KB
testcase_15 AC 21 ms
8,884 KB
testcase_16 AC 81 ms
11,856 KB
testcase_17 AC 28 ms
9,008 KB
testcase_18 AC 54 ms
10,452 KB
testcase_19 AC 46 ms
10,144 KB
testcase_20 AC 82 ms
12,000 KB
testcase_21 AC 33 ms
9,408 KB
testcase_22 AC 25 ms
8,864 KB
testcase_23 AC 58 ms
10,580 KB
testcase_24 AC 91 ms
12,556 KB
testcase_25 AC 18 ms
8,496 KB
testcase_26 AC 85 ms
12,544 KB
testcase_27 AC 86 ms
12,432 KB
testcase_28 AC 17 ms
8,592 KB
testcase_29 AC 18 ms
8,576 KB
testcase_30 AC 93 ms
12,556 KB
testcase_31 AC 90 ms
17,148 KB
testcase_32 AC 58 ms
10,596 KB
testcase_33 AC 88 ms
12,464 KB
testcase_34 AC 79 ms
11,904 KB
testcase_35 AC 43 ms
9,972 KB
testcase_36 AC 29 ms
9,116 KB
testcase_37 AC 57 ms
10,628 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import *
import sys

def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())

def main():
    ii=deque()
    xx=deque()
    n,d,k=MI()
    aa=[II() for _ in range(n)]
    mx=0
    ai=aj=0
    for i in range(n-1,-1,-1):
        x=aa[i]
        if i==n-1:
            ii.append(i)
            xx.append(x)
            continue
        if ii[0]>i+d:
            ii.popleft()
            xx.popleft()
        #print(i,x,ai,aj,mx,ii,xx)
        cur=xx[0]-x
        if cur>=mx:
            mx=cur
            ai=i
            aj=ii[0]
        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