結果
問題 | No.489 株に挑戦 |
ユーザー | rlangevin |
提出日時 | 2023-08-02 12:23:58 |
言語 | PyPy3 (7.3.15) |
結果 |
RE
|
実行時間 | - |
コード長 | 1,117 bytes |
コンパイル時間 | 346 ms |
コンパイル使用メモリ | 82,176 KB |
実行使用メモリ | 148,480 KB |
最終ジャッジ日時 | 2024-04-20 12:25:59 |
合計ジャッジ時間 | 7,108 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | RE | - |
testcase_01 | RE | - |
testcase_02 | AC | 48 ms
54,528 KB |
testcase_03 | AC | 47 ms
54,528 KB |
testcase_04 | AC | 47 ms
54,400 KB |
testcase_05 | RE | - |
testcase_06 | RE | - |
testcase_07 | RE | - |
testcase_08 | RE | - |
testcase_09 | RE | - |
testcase_10 | RE | - |
testcase_11 | RE | - |
testcase_12 | RE | - |
testcase_13 | RE | - |
testcase_14 | RE | - |
testcase_15 | RE | - |
testcase_16 | AC | 246 ms
137,460 KB |
testcase_17 | AC | 188 ms
86,728 KB |
testcase_18 | AC | 193 ms
112,240 KB |
testcase_19 | AC | 162 ms
104,320 KB |
testcase_20 | RE | - |
testcase_21 | RE | - |
testcase_22 | RE | - |
testcase_23 | RE | - |
testcase_24 | RE | - |
testcase_25 | AC | 49 ms
54,656 KB |
testcase_26 | AC | 228 ms
146,272 KB |
testcase_27 | AC | 320 ms
143,484 KB |
testcase_28 | RE | - |
testcase_29 | RE | - |
testcase_30 | RE | - |
testcase_31 | AC | 201 ms
148,480 KB |
testcase_32 | RE | - |
testcase_33 | RE | - |
testcase_34 | RE | - |
testcase_35 | RE | - |
testcase_36 | RE | - |
testcase_37 | RE | - |
ソースコード
from heapq import * from collections import * import sys input = sys.stdin.readline class QuasiBinaryTree: def __init__(self, rule="min"): if rule == "max": self.pm = -1 else: self.pm = 1 self.inf = 10**18 self.P = [self.inf] self.Q = [] def insert(self, x): heappush(self.P, x * self.pm) def erase(self, x): heappush(self.Q, x * self.pm) def top(self): while self.Q and (self.P[0] == self.Q[0]): heappop(self.P) heappop(self.Q) return self.P[0] * self.pm N, D, K = map(int, input().split()) Q = [deque() for i in range(N + 1)] T = QuasiBinaryTree() ansval, ansind = 0, None X = [0] * N for i in range(N): X[i] = int(input()) for i in range(N): T.insert(X[i]) Q[X[i]].append(i) if i >= D + 1: T.erase(X[i - D - 1]) Q[X[i - D - 1]].popleft() temp = X[i] - T.top() if temp > ansval: ansval = temp j = Q[T.top()][0] ansind = (j, i) if ansind: print(K * ansval) print(*ansind) else: print(0)