/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Wrong Answer 2ms 320.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;
        string s;
        cin>>s;
        string p;
        p=s;
        sort(p.begin(),p.end());
        map<char,ll>mp;
        for(int i=0;i<k;i++)
            mp[p[i]]++;
        string l;
        for(int i=0;i<s.size();i++)
        {
            if(mp[s[i]]>0)
                mp[s[i]]--;
            else
                l+=s[i];
        }
        if(l.size()==0) cout<<0<<endl;
        else
            cout<<l<<endl;
    }
}

Information

Submit By
Type
Submission
Problem
P1006 Remove K Digits
Language
C++17 (G++ 13.2.0)
Submit At
2024-11-05 18:37:16
Judged At
2024-11-11 02:25:48
Judged By
Score
0
Total Time
2ms
Peak Memory
320.0 KiB