結果

問題 No.489 株に挑戦
ユーザー sasa8uyauya
提出日時 2024-09-21 14:47:12
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 154 ms / 1,000 ms
コード長 418 bytes
コンパイル時間 204 ms
コンパイル使用メモリ 81,844 KB
実行使用メモリ 78,720 KB
最終ジャッジ日時 2024-09-21 14:47:18
合計ジャッジ時間 5,255 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 35
権限があれば一括ダウンロードができます

ソースコード

diff #

n,D,K=map(int,input().split())
a=(0,0,0)
from collections import deque
q=deque()
for i in range(1):
  x=int(input())
  while len(q)>0 and q[-1][0]>x:
    q.pop()
  q.append((x,i))
for i in range(1,n):
  x=int(input())
  y,j=q[0]
  a=min(a,(-(x-y),j,i))
  while len(q)>0 and q[-1][0]>x:
    q.pop()
  q.append((x,i))
  if q[0][1]==i-D:
    q.popleft()
p1,p2,p3=a
if p1!=0:
  print(-p1*K)
  print(p2,p3)
else:
  print(0)
0