/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Wrong Answer 2ms 536.0 KiB

Code

#include<bits/stdc++.h>
using namespace std;
#define ll long long

int main()
{
    ll t;
    cin>>t;
    while(t--){
        ll n,k;
        cin>>n>>k;
        string s;
        cin>>s;
        vector<pair<ll,ll> >v,a;
        for(ll i=0;i<n;i++){
            ll x=s[i]-'0';
            v.push_back({x,i});
        }
        sort(v.begin(),v.end());
        for(ll i=0;i<n;i++){
             if(i>k-1)
             a.push_back({v[i].second,v[i].first});
        }
        sort(a.begin(),a.end());
        if(a.size()==0){
            cout<<0<<endl;
        }
        else{
            for(ll i=0;i<a.size();i++){
                cout<<a[i].second;
            }
            cout<<endl;
        }

    }
}

Information

Submit By
Type
Submission
Problem
P1006 Remove K Digits
Contest
Sylhet ICPC 2024 Collaborative Challenge: Episode 2
Language
C++17 (G++ 13.2.0)
Submit At
2024-10-30 09:03:40
Judged At
2024-10-30 09:03:40
Judged By
Score
0
Total Time
2ms
Peak Memory
536.0 KiB