結果
| 問題 | No.3656 Game Scores and Costs |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-09-09 15:05:21 |
| 言語 | Python3 (3.14.7 + numpy 2.5.2 + scipy 1.18.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 244 ms / 2,000 ms |
| + 177µs | |
| コード長 | 415 bytes |
| 記録 | |
| コンパイル時間 | 55 ms |
| コンパイル使用メモリ | 15,232 KB |
| 実行使用メモリ | 33,196 KB |
| 最終ジャッジ日時 | 2026-09-09 15:06:17 |
| 合計ジャッジ時間 | 5,545 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 |
ソースコード
import heapq
import sys
imput = sys.stdin.readline
n, k, x = map(int, input().split())
a = list(map(int, input().split()))
hq = []
top = 0
ans = -10 ** 18
for i in range(1, n + 1):
t = a[i - 1]
heapq.heappush(hq, t)
top += t
if len(hq) > k:
removed = heapq.heappop(hq)
top -= removed
#print(hq)
result = top - i * x
if result > ans:
ans = result
print(ans)