結果
問題 | No.489 株に挑戦 |
ユーザー |
|
提出日時 | 2022-03-24 19:18:17 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 118 ms / 1,000 ms |
コード長 | 569 bytes |
コンパイル時間 | 349 ms |
コンパイル使用メモリ | 82,452 KB |
実行使用メモリ | 79,636 KB |
最終ジャッジ日時 | 2024-10-13 02:58:37 |
合計ジャッジ時間 | 4,823 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 35 |
ソースコード
N,D,K = map(int,input().split())x = [int(input()) for _ in range(N)]from collections import dequeq = deque()for i in range(D+1):while q and x[q[-1]] < x[i]:q.pop()q.append(i)ans = 0left = -1right = -1for i in range(N):tmp = x[q[0]] - x[i]if tmp > ans:ans = tmpleft = iright = q[0]if i + D + 1 < N:while q and x[q[-1]] < x[i+D+1]:q.pop()q.append(i+D+1)if q[0] == i:q.popleft()if ans == 0:print(0)else:print(ans * K)print(left,right)