結果

問題 No.489 株に挑戦
ユーザー qibqib
提出日時 2023-02-17 10:44:23
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 506 bytes
コンパイル時間 285 ms
コンパイル使用メモリ 86,564 KB
実行使用メモリ 81,872 KB
最終ジャッジ日時 2023-09-26 11:45:01
合計ジャッジ時間 9,308 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 294 ms
78,644 KB
testcase_01 AC 196 ms
78,220 KB
testcase_02 AC 92 ms
71,600 KB
testcase_03 AC 94 ms
71,508 KB
testcase_04 AC 93 ms
71,468 KB
testcase_05 AC 93 ms
71,520 KB
testcase_06 AC 93 ms
71,596 KB
testcase_07 AC 95 ms
71,572 KB
testcase_08 AC 93 ms
71,236 KB
testcase_09 AC 94 ms
71,352 KB
testcase_10 AC 94 ms
71,468 KB
testcase_11 AC 95 ms
71,456 KB
testcase_12 AC 94 ms
71,384 KB
testcase_13 AC 95 ms
71,468 KB
testcase_14 AC 94 ms
71,432 KB
testcase_15 AC 124 ms
77,576 KB
testcase_16 AC 342 ms
78,332 KB
testcase_17 AC 147 ms
78,072 KB
testcase_18 AC 193 ms
78,028 KB
testcase_19 AC 165 ms
78,016 KB
testcase_20 AC 349 ms
78,280 KB
testcase_21 AC 141 ms
77,844 KB
testcase_22 AC 132 ms
78,332 KB
testcase_23 AC 193 ms
78,476 KB
testcase_24 AC 314 ms
79,100 KB
testcase_25 AC 93 ms
71,408 KB
testcase_26 AC 417 ms
81,024 KB
testcase_27 WA -
testcase_28 AC 93 ms
71,496 KB
testcase_29 AC 95 ms
71,116 KB
testcase_30 AC 342 ms
79,352 KB
testcase_31 AC 285 ms
81,872 KB
testcase_32 AC 175 ms
78,792 KB
testcase_33 AC 215 ms
79,260 KB
testcase_34 AC 331 ms
78,308 KB
testcase_35 AC 156 ms
78,104 KB
testcase_36 AC 129 ms
77,560 KB
testcase_37 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque

n, d, k = map(int, input().split())
x = [int(input()) for _ in range(n)]

idx = deque()
dq = deque()
for i in range(n):
  while len(dq) > 0 and x[i] <= x[dq[-1]]:
    dq.pop()

  dq.append(i)
  idx.append(dq[0])

  if len(dq) and dq[0] <= i + 1 - (d + 1):
    dq.popleft()

ans = 0
l = None
r = None
for i in range(n):
  score = (x[i] - x[idx[i]]) * k
  if score > ans:
    r = i
    l = idx[i]
    ans = score

if ans > 0:
  print(ans)
  print(f"{l} {r}")
else:
  print("0")
0