Code
#include<bits/stdc++.h>
#define ll long long
#define endl '\n'
using namespace std;
int main()
{
ios_base:: sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
ll t;
cin>>t;
while(t--){
ll n, k;
cin>>n>>k;
string st;
cin>>st;
if(n==k){
cout<<'0'<<endl;
}
else{
ll arr[n];
vector<ll>arr2;
for(ll i=0; i<st.size(); i++){
ll tm= st[i]-'0';
arr[i]= tm;
arr2.push_back(tm);
}
sort(arr, arr+n);
for(ll i=n-1; i>=k; i--){
cout<<arr[i];
}
cout<<endl;
}
}
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 11:07:25
- Judged At
- 2024-11-11 02:34:58
- Judged By
- Score
- 0
- Total Time
- 2ms
- Peak Memory
- 324.0 KiB