Wrong Answer
Code
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define nl endl
#define ss string
#define dl double
#define yes cout << "YES" << nl;
#define no cout << "NO" << nl;
int main() {
ll t; cin >> t;
while(t--)
{
ll n, k, sum=0;
cin>>n>>k;
vector<ll>v(n);
for (int i = 0; i < v.size(); i++)
{
cin>>v[i];
}
sort(v.begin(), v.end());
for (int i = 0; i < k; i++)
{
sum+=v[i];
}
cout<<sum<<endl;
}
// for (int i = 1; i <= t; i++)
// {
// /* code */
// }
return 0;
}
Information
- Submit By
- Type
- Submission
- Problem
- P1149 Swap and Minimize
- Contest
- LU IUJPC : Sylhet Division 2024
- Language
- C++17 (G++ 13.2.0)
- Submit At
- 2024-12-09 05:35:35
- Judged At
- 2024-12-09 05:35:35
- Judged By
- Score
- 1
- Total Time
- 74ms
- Peak Memory
- 600.0 KiB