結果
問題 | No.489 株に挑戦 |
ユーザー |
![]() |
提出日時 | 2020-03-13 18:43:02 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 673 bytes |
コンパイル時間 | 260 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 20,012 KB |
最終ジャッジ日時 | 2024-11-22 12:53:28 |
合計ジャッジ時間 | 4,975 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 33 WA * 2 |
ソースコード
#!/usr/bin/env python3.8 # %% import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines from collections import deque # %% N, D, K, *X = map(int, read().split()) # %% def gen_cand(): q = deque([0]) for k, x in enumerate(X[1:], 1): while q[0] < k - D: q.popleft() j = q[0] diff = x - X[j] yield j, k, diff while q and X[q[-1]] >= x: q.pop() q.append(k) # %% best = 0, 0, 0 for j, k, x in gen_cand(): if best[2] < x: best = j, k, x if best[2] == 0: print(0) else: print(best[2] * K) print(best[0], best[1])