結果
| 問題 | No.3656 Game Scores and Costs |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-08-30 13:55:07 |
| 言語 | C++23(gcc16) (gcc 16.1.0 + boost 1.92.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 534 bytes |
| 記録 | |
| コンパイル時間 | 2,316 ms |
| コンパイル使用メモリ | 355,840 KB |
| 実行使用メモリ | 6,272 KB |
| 最終ジャッジ日時 | 2026-08-30 13:55:14 |
| 合計ジャッジ時間 | 6,186 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | TLE * 1 -- * 20 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, k, x;
long long ans=-9999999999999999;
cin >> n >> k >> x;
vector<long long> a(n);
priority_queue<long long> b;
for(int i=0; i<n; i++) cin >> a.at(i);
for(int i=0; i<n; i++) {
b.push(a.at(i));
priority_queue<long long> c = b;
long long f=0;
for(int j=0; j<min(i+1, k); j++) {
f += c.top();
c.pop();
}
f -= (i+1)*x;
ans = max(ans, f);
}
cout << ans;
}