CSES - Datatähti 2018 loppu - Results
Submission details
Task:Merkkijono
Sender:inkeri
Submission time:2018-01-18 13:45:48 +0200
Language:Python3
Status:READY
Result:0
Feedback
groupverdictscore
#10
Test results
testverdicttime
#10.07 sdetails
#20.07 sdetails
#30.08 sdetails
#40.06 sdetails
#50.09 sdetails

Code

a = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
b = list(input())
c = []
d = ["SWAP\n", "MOVE\n", "MOVE\nSWAP\n"]
for i in range(1, 27):
    x = b.index(a[-i])
    if x == 0:
        continue
    if x == 1:
        c.append(d[0])
        b[0], b[1] = b[1], b[0]
    else:
        c.append(d[2] * (26 - x))
        c.append(d[1])
        b = [b[x]] + b[:i] + b[x+1:] + b[i:x]

print(len(c))
print("".join(c))
        

Test details

Test 1

Verdict:

input
ABCDEFGHIJKLMNOPQRSTUVWXYZ

correct output
0

user output
52
MOVE
SWAP
MOVE
MOVE
...

Test 2

Verdict:

input
ZYXWVUTSRQPONMLKJIHGFEDCBA

correct output
923
MOVE
MOVE
SWAP
MOVE
...

user output
49
SWAP
MOVE
SWAP
MOVE
...

Test 3

Verdict:

input
RPJMFWBHYQOTXUAENLDGZISCVK

correct output
611
SWAP
MOVE
MOVE
SWAP
...

user output
52
MOVE
SWAP
MOVE
SWAP
...

Test 4

Verdict:

input
GWJSPBHANMXYFLKIDORVUCEZQT

correct output
659
MOVE
SWAP
MOVE
SWAP
...

user output
52
MOVE
SWAP
MOVE
SWAP
...

Test 5

Verdict:

input
BJYNFLKEIUCZMQHRAXOGWPSDTV

correct output
624
MOVE
SWAP
MOVE
SWAP
...

user output
52
MOVE
SWAP
MOVE
SWAP
...