CSES - Datatähti 2018 loppu - Results
Submission details
Task:Merkkijono
Sender:Jace
Submission time:2018-01-18 13:29:57 +0200
Language:C++
Status:READY
Result:0
Feedback
groupverdictscore
#10
Test results
testverdicttime
#1--details
#2--details
#3--details
#4--details
#5--details

Code

#include <iostream>
#include <vector>
#include <cstdio>
#include <string.h>

using namespace std;

int main(){
    vector<bool> ops;
    bool finished = false;
    char string[27];
    char k;
    for (int i = 0; i < 26; i++){
        string[i] = std::cin.get();
    }
    while (finished == false){
        if (string[0] < string[1]){
            ops.push_back(false);
            k = string[25];
            memcpy(string+1, string, 26);
            string[0] = k;
        } else {
            ops.push_back(true);
            k = string[0];
            string[0] = string[1];
            string[1] = k;
        }
        finished = true;
        for (int i = 0; i < 26; i++){
            if (string[i]-65 != i){
                finished = false;
                break;
            }
        }
    }
    printf("%ld\n", ops.size());
    for (unsigned int i = 0; i < ops.size(); i++){
        if (ops[i]){
            cout << "SWAP\n";
        } else {
            cout << "MOVE\n";
        }
    }

}

Test details

Test 1

Verdict:

input
ABCDEFGHIJKLMNOPQRSTUVWXYZ

correct output
0

user output
(empty)

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)