/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 2ms 532.0 KiB
#2 Wrong Answer 1ms 324.0 KiB
#3 Wrong Answer 1ms 336.0 KiB

Code


#include<bits/stdc++.h>
using namespace std;
int main()
{
   int t;
   cin >>t;
   while(t--){
    int a,b;
    cin >> a>>b;
    string s;
    cin >>s;
    int i=0;
    int cnt=0;
    while(i<=a){
        if(s[i]!=s[a-1]){
            if(s[i]>s[a-1]){
                swap(s[i], s[a-1]);
                cnt++;
            }

        }
        if(cnt==b){
            break;
        }
        i++;
        a--;
    }
    cout<<s<<endl;
   }
    return 0;
}

Information

Submit By
Type
Submission
Problem
P1058 Lexicographically Smallest String
Contest
Sylhet ICPC 2024 Collaborative Challenge: Episode 2
Language
C++17 (G++ 13.2.0)
Submit At
2024-10-30 09:13:41
Judged At
2024-11-11 02:35:25
Judged By
Score
5
Total Time
2ms
Peak Memory
532.0 KiB