Wrong Answer
Code
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define srt(v) sort(v.begin(), v.end())
#define rsrt(v) sort(v.rbegin(), v.rend())
#define pb push_back
void solve(){
ll n, k; cin >> n >> k;
vector<ll>v(n);
for(int i=0; i<n; i++){
cin >> v[i];
}
sort(v.begin(), v.end());
ll sum=0;
for(int i=0; i<k; i++){
sum+=v[i];
}
cout << sum << endl;
}
signed main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int t; cin >> t;
while(t--){
solve();
}
}
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:26:28
- Judged At
- 2024-12-09 05:26:28
- Judged By
- Score
- 1
- Total Time
- 40ms
- Peak Memory
- 628.0 KiB