結果

問題 No.1046 Fruits Rush
ユーザー matcharate12matcharate12
提出日時 2022-03-15 19:03:40
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 485 bytes
コンパイル時間 2,182 ms
コンパイル使用メモリ 172,984 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-09-22 11:14:23
合計ジャッジ時間 2,511 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 11 WA * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <string.h>
#define rep(i,n) for(int i = 0; i < n; i++)
#define srep(i,a,b) for(int i = a; i < b; i++)
#define all(A) (A).begin(),A.end()
#define MOD 1000000007
using namespace std;
using ll = long long;
using P = pair<char,int>;
using Graph = vector<vector<int>>;

int main(void){
	int n,k; cin >> n >> k;
	vector<int> A(n); rep(i,n) cin >> A[i];
	sort(all(A),greater<int>());

	int sum = 0;
	rep(i,k) sum = max(sum+A[i],sum);
	cout << sum << endl;
}
0