結果
| 問題 |
No.1046 Fruits Rush
|
| コンテスト | |
| ユーザー |
QCFium
|
| 提出日時 | 2020-05-08 21:21:27 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 342 bytes |
| コンパイル時間 | 386 ms |
| コンパイル使用メモリ | 51,760 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-03 23:10:02 |
| 合計ジャッジ時間 | 922 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 11 WA * 3 |
ソースコード
#include <stdio.h>
#include <algorithm>
#include <functional>
int ri() {
int n;
scanf("%d", &n);
return n;
}
int main() {
int n = ri();
int k = ri();
int a[n];
for (auto &i : a) i = ri();
std::sort(a, a + n, std::greater<>());
int res = 0;
for (int i = 0; i < k; i++) if (a[i] > 0) res += a[i];
printf("%d\n", res);
return 0;
}
QCFium