/ SeriousOJ /

Record Detail

Wrong Answer


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

Code

#include<bits/stdc++.h>
using namespace std;
#define ll long long;
int getmn(string &s)
{
    int idx=0;
    for(int i=1; i<s.size(); i++)
    {
        if(s[i]<s[idx])
        {
            idx=i;
        }
    }
    return idx;
}
int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        int n,k;
        cin>>n>>k;
        if(n==0)
        {
            cout<<" "<<"\n";
            return 0;
        }
        string s;
        cin>>s;
         if(n==k)
        {
            cout<<"0"<<"\n";
        }
        else
        {
            while(k>0)
            {
                int mn=getmn(s);
                s.erase(mn,1);
                k--;
            }
            cout<<s<<"\n";
        }
    }
    return 0;
}

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 12:19:10
Judged At
2024-10-30 12:19:10
Judged By
Score
0
Total Time
2ms
Peak Memory
540.0 KiB