結果

問題 No.3656 Game Scores and Costs
コンテスト
ユーザー 福島 孝太/Raiou_B
提出日時 2026-08-30 16:09:12
言語 PyPy3
(7.3.23)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
TLE  
実行時間 -
コード長 478 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 242 ms
コンパイル使用メモリ 96,232 KB
実行使用メモリ 116,352 KB
最終ジャッジ日時 2026-08-30 16:09:17
合計ジャッジ時間 4,639 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other TLE * 1 -- * 20
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

n, k, x = map(int, input().split())
a = list(map(int, input().split()))

score = -x

counter = []
for i in range(1, n+1):
	count = min(k, i)
	
	ba = a[:i]
	ba.sort(reverse = True)
	
	counter.append(sum(ba[:count]))

for i in range(1, n+1):
	"""
	scoref = []
	
	
	ba = a[:i]
	ba.sort(reverse = True)
	
	for j in range(min(k, i)):
		scoref.append(ba[j])
	
	curr_score = sum(scoref) - x*i
	"""

	curr_score = counter[i-1] - x*i
	
	score = max(curr_score, score)
	
	
print(score)

	
0