/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 532.0 KiB
#2 Wrong Answer 1ms 348.0 KiB
#3 Wrong Answer 2ms 480.0 KiB

Code

#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int t;
    cin >> t;
    while (t--)
    {
        ll n, m;
        cin >> n >> m;
        string s;
        cin >> s;
        ll l = 0;
        ll r = s.size() - 1;
        for (int i = 1; i <= r; i++)
        {
            if (s[l]>s[r])
            {
                // int tmp = s[l];
                // s[l] = s[r];
                // s[r] = tmp;
                swap(s[l],s[r]);
            }
            l++;
            r--;
        }
        cout << s << endl;
    }
}

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 12:34:35
Judged At
2024-11-11 02:34:36
Judged By
Score
5
Total Time
2ms
Peak Memory
532.0 KiB