/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 540.0 KiB
#2 Wrong Answer 48ms 600.0 KiB
#3 Wrong Answer 74ms 548.0 KiB

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