結果
問題 |
No.3050 Prefix Removal
|
ユーザー |
|
提出日時 | 2025-03-07 21:55:51 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 603 bytes |
コンパイル時間 | 880 ms |
コンパイル使用メモリ | 76,000 KB |
実行使用メモリ | 9,172 KB |
最終ジャッジ日時 | 2025-03-07 21:56:04 |
合計ジャッジ時間 | 12,544 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 50 WA * 5 |
ソースコード
#include <iostream> #include <queue> using namespace std; typedef long long ll; const ll INF = 1000000000000000000; int main() { int n, k; cin >> n >> k; priority_queue<ll, vector<ll>, greater<ll>> que; ll s; cin >> s; ll x = s; ll ans = -INF; for (int i = 1; i < n; i++) { ll a; cin >> a; que.push(-s); s += a; x += a * ((int)que.size() + 1); if (i >= k) { ll t = que.top(); x -= s + t; que.pop(); ans = max(ans, x); } } cout << ans << endl; }