/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 2ms 540.0 KiB
#2 Wrong Answer 71ms 580.0 KiB
#3 Wrong Answer 129ms 612.0 KiB

Code

#include<bits/stdc++.h>
using namespace std;
#define ll long long int 
int main()
{
    ll tc;
    cin>>tc;
    while(tc--)
    {
        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 ans=0;
        for(int i=0;i<min(n,k);i++)
            ans+=v[i];
        cout<<ans<<endl;
    }
}

Information

Submit By
Type
Submission
Problem
P1149 Swap and Minimize
Language
C++17 (G++ 13.2.0)
Submit At
2024-12-11 08:31:00
Judged At
2024-12-11 08:31:00
Judged By
Score
1
Total Time
129ms
Peak Memory
612.0 KiB