Wrong Answer
Code
#include<bits/stdc++.h>
using namespace std;
#define int long long
void solve()
{
int n,k; cin>>n>>k;
vector<int>v(n);
for(int i=0;i<n;i++) cin>>v[i];
sort(v.begin(),v.end());
int ans = 0;
for(int i=0;i<min(k,n);i++)
{
ans+=v[i];
}
cout<<ans<<endl;
}
int32_t main()
{
int t;
cin>>t;
// t=1;
while(t--)
{
solve();
}
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:09:23
- Judged At
- 2024-12-09 05:09:23
- Judged By
- Score
- 1
- Total Time
- 74ms
- Peak Memory
- 800.0 KiB