/ SeriousOJ /

Record Detail

Wrong Answer


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

Code

#pragma GCC optimize("O3,unroll-loops")
#include<bits/stdc++.h>
using namespace std;

#define fastio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define nline "\n"
#define pb push_back
#define ppb pop_back
#define set_bits __builtin_popcountll
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()

typedef long long ll;
typedef long long int lli;
typedef unsigned long long ull;
typedef long double lld;
const int MK=60;
const ll MOD=1000000007;

void solve(){
    int t;
    cin>>t;
    while(t--){
        lli n,k;
        cin>>n>>k;
        string s;
        cin>>s;
        string temp=s;
        sort(all(temp));
        unordered_map<char,int>mp;
        for(lli i=k;i<n;i++){
            mp[temp[i]]++;
        }
        string ans="";
        for(lli i=0;i<n;i++){
            if(mp.find(s[i])!=mp.end()){
                ans+=s[i];
            }
        }
        cout<<(ans.size()==0?"0":ans)<<nline;

    }

}

int main(){
    fastio();
    solve();
    return 0;
}

Information

Submit By
Type
Submission
Problem
P1006 Remove K Digits
Language
C++17 (G++ 13.2.0)
Submit At
2024-11-04 06:16:50
Judged At
2024-11-04 06:16:50
Judged By
Score
0
Total Time
2ms
Peak Memory
532.0 KiB