Submission #14528999
Source Code Expand
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define ll long long
using namespace std;
//typedef vector<unsigned int>vec;
//typedef vector<ll>vec;
//typedef vector<vec> mat;
typedef pair<int, int> P;
typedef pair<ll,ll> LP;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int INF = 1000000000;
const ll LINF = 1000000000000000000;//1e18
const ll MOD = 1000000007;
const ll MOD2 = 998244353;
const double PI = acos(-1.0);
const double EPS = 1e-10;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
//template<class T> inline void add(T &a, T b){a = ((a+b) % MOD + MOD) % MOD;};
void solve(){
int N, K;
cin >> N >> K;
vector<int> p(N);
REP(i,N) cin >> p[i];
sort(p.begin(), p.end());
int sum = 0;
REP(i,K) sum += p[i];
cout << sum << endl;
}
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
solve();
// int T; cin >> T; REP(t,T) solve();
}
Submission Info
| Submission Time |
|
| Task |
B - Mix Juice |
| User |
Bondo416 |
| Language |
C++ (GCC 9.2.1) |
| Score |
200 |
| Code Size |
1155 Byte |
| Status |
AC |
| Exec Time |
7 ms |
| Memory |
3660 KiB |
Judge Result
| Set Name |
Sample |
All |
| Score / Max Score |
0 / 0 |
200 / 200 |
| Status |
|
|
| Set Name |
Test Cases |
| Sample |
a01.txt, a02.txt |
| All |
a01.txt, a02.txt, b03.txt, b04.txt, b05.txt, b06.txt, b07.txt, b08.txt, b09.txt, b10.txt, b11.txt, b12.txt |
| Case Name |
Status |
Exec Time |
Memory |
| a01.txt |
AC |
6 ms |
3548 KiB |
| a02.txt |
AC |
4 ms |
3512 KiB |
| b03.txt |
AC |
3 ms |
3600 KiB |
| b04.txt |
AC |
3 ms |
3620 KiB |
| b05.txt |
AC |
4 ms |
3616 KiB |
| b06.txt |
AC |
2 ms |
3504 KiB |
| b07.txt |
AC |
2 ms |
3492 KiB |
| b08.txt |
AC |
7 ms |
3496 KiB |
| b09.txt |
AC |
2 ms |
3580 KiB |
| b10.txt |
AC |
2 ms |
3660 KiB |
| b11.txt |
AC |
2 ms |
3616 KiB |
| b12.txt |
AC |
3 ms |
3604 KiB |