結果
| 問題 | No.3656 Game Scores and Costs |
| コンテスト | |
| ユーザー |
sepa38
|
| 提出日時 | 2026-08-27 13:11:38 |
| 言語 | PyPy3 (7.3.23 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 171 ms / 2,000 ms |
| + 537µs | |
| コード長 | 322 bytes |
| 記録 | |
| コンパイル時間 | 248 ms |
| コンパイル使用メモリ | 95,976 KB |
| 実行使用メモリ | 117,248 KB |
| 最終ジャッジ日時 | 2026-08-30 13:03:58 |
| 合計ジャッジ時間 | 5,600 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 |
ソースコード
import heapq
n, k, x = map(int, input().split())
a = list(map(int, input().split()))
score = 0
h = []
ans = -(1<<60)
for i, ai in enumerate(a):
score += ai
heapq.heappush(h, ai)
if len(h) > k:
m = heapq.heappop(h)
score -= m
res = score - x * (i + 1)
ans = max(ans, res)
print(ans)
sepa38