結果
| 問題 |
No.409 ダイエット
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-06-28 19:31:46 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 353 bytes |
| コンパイル時間 | 550 ms |
| コンパイル使用メモリ | 82,344 KB |
| 実行使用メモリ | 117,996 KB |
| 最終ジャッジ日時 | 2025-06-28 19:31:59 |
| 合計ジャッジ時間 | 11,692 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 17 WA * 75 |
ソースコード
n, a, b, w = map(int, input().split())
D = list(map(int, input().split()))
from collections import deque
stack = deque([1<<60])
ans = 0
num = 0
for d in D:
while stack and stack[-1]>d:
stack.pop()
stack.append(d)
if stack and b*(num+1)-a>stack[-1]:
ans += stack.popleft()
num = 0
else:
num += 1
ans += b*num-a
print(ans+w)