Wrong Answer
Code
#include<bits/stdc++.h>
#include <vector>
using namespace std;
int main(){
int t,n,k;
cin>>t;
int sum=0;
while(t--)
{
cin>>n>>k;
vector<int>a(n);
for(int i=0; i<n; i++)
{
cin>>a[i];
}
sort(a.begin(),a.end());
for(int i=0; i<k;i++)
{
sum+=a[i];
}
cout<<sum<<endl;
sum=0;
}
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 09:01:58
- Judged At
- 2024-12-09 09:01:58
- Judged By
- Score
- 1
- Total Time
- 79ms
- Peak Memory
- 608.0 KiB