CSES - Datatähti 2018 loppu - Results
Submission details
Task:Merkkijono
Sender:Kuha
Submission time:2018-01-18 12:22:44 +0200
Language:C++
Status:READY
Result:0
Feedback
groupverdictscore
#10
Test results
testverdicttime
#1ACCEPTED0.04 sdetails
#2--details
#3--details
#4--details
#5--details

Code

#include <bits/stdc++.h>

using namespace std;

int main () {
    string s;
    cin>>s;
    string ans = s;
    sort(ans.begin(), ans.end());
    vector<int> lol;
    while (ans != s) {
        if (s[0] > s[1]) {
            swap(s[0], s[1]);
            lol.push_back(1);
        } else {
            char c = s[25];
            s.pop_back();
            s = c + s;
            lol.push_back(2);
        }
    }
    cout<<lol.size()<<endl;
    for (int i : lol) {
        if (i == 1) cout<<"SWAP"<<endl;
        else cout<<"MOVE"<<endl;
    }
}

Test details

Test 1

Verdict: ACCEPTED

input
ABCDEFGHIJKLMNOPQRSTUVWXYZ

correct output
0

user output
0

Test 2

Verdict:

input
ZYXWVUTSRQPONMLKJIHGFEDCBA

correct output
923
MOVE
MOVE
SWAP
MOVE
...

user output
(empty)

Test 3

Verdict:

input
RPJMFWBHYQOTXUAENLDGZISCVK

correct output
611
SWAP
MOVE
MOVE
SWAP
...

user output
(empty)

Test 4

Verdict:

input
GWJSPBHANMXYFLKIDORVUCEZQT

correct output
659
MOVE
SWAP
MOVE
SWAP
...

user output
(empty)

Test 5

Verdict:

input
BJYNFLKEIUCZMQHRAXOGWPSDTV

correct output
624
MOVE
SWAP
MOVE
SWAP
...

user output
(empty)