Submission #14611203


Source Code Expand

#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
            ∧_∧
      ∧_∧  (´<_` )  Welcome to My Coding Space!
     ( ´_ゝ`) /  ⌒i     @hamayanhamayan0
    /   \     | |
    /   / ̄ ̄ ̄ ̄/  |
  __(__ニつ/     _/ .| .|____
     \/____/ (u ⊃
---------------------------------------------------------------------------------------------------*/














int N, K, p[1010];
//---------------------------------------------------------------------------------------------------
void _main() {
	cin >> N >> K;
	rep(i, 0, N) cin >> p[i];

	int ans = 0;
	sort(p, p + N);
	rep(i, 0, K) ans += p[i];
	cout << ans << endl;
}





Submission Info

Submission Time
Task B - Mix Juice
User hamayanhamayan
Language C++ (GCC 9.2.1)
Score 200
Code Size 1560 Byte
Status AC
Exec Time 9 ms
Memory 3660 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 200 / 200
Status
AC × 2
AC × 12
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 9 ms 3660 KiB
a02.txt AC 2 ms 3616 KiB
b03.txt AC 3 ms 3540 KiB
b04.txt AC 2 ms 3484 KiB
b05.txt AC 2 ms 3624 KiB
b06.txt AC 3 ms 3648 KiB
b07.txt AC 2 ms 3572 KiB
b08.txt AC 2 ms 3484 KiB
b09.txt AC 3 ms 3548 KiB
b10.txt AC 2 ms 3596 KiB
b11.txt AC 2 ms 3660 KiB
b12.txt AC 4 ms 3612 KiB