結果

問題 No.489 株に挑戦
ユーザー takakintakakin
提出日時 2020-06-21 23:18:59
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 244 ms / 1,000 ms
コード長 708 bytes
コンパイル時間 95 ms
コンパイル使用メモリ 11,076 KB
実行使用メモリ 36,024 KB
最終ジャッジ日時 2023-09-27 06:13:28
合計ジャッジ時間 4,270 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 105 ms
16,752 KB
testcase_01 AC 96 ms
17,692 KB
testcase_02 AC 17 ms
8,704 KB
testcase_03 AC 17 ms
8,564 KB
testcase_04 AC 17 ms
8,628 KB
testcase_05 AC 17 ms
8,696 KB
testcase_06 AC 17 ms
8,676 KB
testcase_07 AC 17 ms
8,724 KB
testcase_08 AC 18 ms
8,632 KB
testcase_09 AC 18 ms
8,552 KB
testcase_10 AC 17 ms
8,576 KB
testcase_11 AC 17 ms
8,616 KB
testcase_12 AC 17 ms
8,616 KB
testcase_13 AC 17 ms
8,552 KB
testcase_14 AC 17 ms
8,684 KB
testcase_15 AC 23 ms
9,144 KB
testcase_16 AC 145 ms
22,852 KB
testcase_17 AC 33 ms
10,160 KB
testcase_18 AC 77 ms
14,224 KB
testcase_19 AC 79 ms
15,164 KB
testcase_20 AC 152 ms
23,896 KB
testcase_21 AC 56 ms
12,936 KB
testcase_22 AC 26 ms
9,436 KB
testcase_23 AC 77 ms
14,340 KB
testcase_24 AC 166 ms
24,856 KB
testcase_25 AC 16 ms
8,636 KB
testcase_26 AC 199 ms
33,940 KB
testcase_27 AC 131 ms
22,816 KB
testcase_28 AC 17 ms
8,628 KB
testcase_29 AC 17 ms
8,544 KB
testcase_30 AC 225 ms
32,032 KB
testcase_31 AC 244 ms
36,024 KB
testcase_32 AC 82 ms
14,680 KB
testcase_33 AC 157 ms
24,780 KB
testcase_34 AC 129 ms
19,288 KB
testcase_35 AC 63 ms
13,368 KB
testcase_36 AC 40 ms
11,444 KB
testcase_37 AC 114 ms
19,160 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input=lambda: sys.stdin.readline().rstrip()
inf=float("inf")
n,d,k=map(int,input().split())
X=[inf]*d+[int(input()) for _ in range(n)]+[inf]*d
from collections import deque
def Slide_Min(A,n,k):
  M=deque()
  ret=[]
  M.append(0)
  for i in range(n):
    while M:
      if A[M[-1]]>A[i]:
        M.pop()
      else:
        M.append(i)
        break
    if not M:
      M.append(i)
    if M[0]==i-k:
      M.popleft()
    if i<k-1:
      continue
    else:
      ret.append((A[M[0]],M[0]))
  return ret
SM=Slide_Min(X,n+2*d,d+1)
Ans=[0,0,0]
for i in range(n):
  if X[i+d]-SM[i][0]>Ans[0]:
    Ans=(X[i+d]-SM[i][0],SM[i][1]-d,i)
if Ans==[0,0,0]:
  print(0)
else:
  print(k*Ans[0])
  print(*Ans[1:])
0