結果
| 問題 | No.1046 Fruits Rush |
| コンテスト | |
| ユーザー |
ldsyb
|
| 提出日時 | 2026-09-12 00:32:35 |
| 言語 | C++23 (gcc 15.3.0 + boost 1.92.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 1 ms / 2,000 ms |
| + 389µs | |
| コード長 | 486 bytes |
| 記録 | |
| コンパイル時間 | 4,160 ms |
| コンパイル使用メモリ | 380,732 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-09-12 00:33:05 |
| 合計ジャッジ時間 | 5,812 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 14 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using namespace chrono;
#if __has_include(<atcoder/all>)
#include <atcoder/all>
using namespace atcoder;
#endif
int main() {
int64_t n, k;
cin >> n >> k;
vector<int64_t> as(n);
for (auto &&a : as) {
cin >> a;
}
ranges::sort(as);
ranges::reverse(as);
int64_t ans = as[0];
for (int64_t i = 1; i < k; i++) {
ans += max<int64_t>(0, as[i]);
}
cout << ans << endl;
return 0;
}
ldsyb