CSES - Datatähti 2018 loppu - Results
Submission details
Task:Merkkijono
Sender:Kameli
Submission time:2018-01-18 14:18:45 +0200
Language:Python3
Status:READY
Result:100
Feedback
groupverdictscore
#1ACCEPTED100
Test results
testverdicttime
#1ACCEPTED0.09 sdetails
#2ACCEPTED0.09 sdetails
#3ACCEPTED0.09 sdetails
#4ACCEPTED0.07 sdetails
#5ACCEPTED0.07 sdetails

Code

a=list(input())
c=25
chars='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
op=[]
i=0
def getI(char):
    global a
    for i in range(len(a)):
        if a[i]==char:
            return i
def swapTwo(i):
    global a
    if i==0:
        a[0],a[1]=a[1],a[0]
        op.append("SWAP")
        return
    for j in range(26-i):
        a=[a[25]]+a[:25]
        op.append("MOVE")
    a[0],a[1]=a[1],a[0]
    op.append("SWAP")
    for j in range(i):
        a=[a[25]]+a[:25]
        op.append("MOVE")
while a!=list('ABCDEFGHIJKLMNOPQRSTUVWXYZ'):
    for i in range(25):
        if a[i]>a[i+1]:
            swapTwo(i)
print(len(op))
for i in op:
    print(i)

Test details

Test 1

Verdict: ACCEPTED

input
ABCDEFGHIJKLMNOPQRSTUVWXYZ

correct output
0

user output
0

Test 2

Verdict: ACCEPTED

input
ZYXWVUTSRQPONMLKJIHGFEDCBA

correct output
923
MOVE
MOVE
SWAP
MOVE
...

user output
8125
SWAP
MOVE
MOVE
MOVE
...

Test 3

Verdict: ACCEPTED

input
RPJMFWBHYQOTXUAENLDGZISCVK

correct output
611
SWAP
MOVE
MOVE
SWAP
...

user output
4487
SWAP
MOVE
MOVE
MOVE
...

Test 4

Verdict: ACCEPTED

input
GWJSPBHANMXYFLKIDORVUCEZQT

correct output
659
MOVE
SWAP
MOVE
SWAP
...

user output
3809
MOVE
MOVE
MOVE
MOVE
...

Test 5

Verdict: ACCEPTED

input
BJYNFLKEIUCZMQHRAXOGWPSDTV

correct output
624
MOVE
SWAP
MOVE
SWAP
...

user output
3538
MOVE
MOVE
MOVE
MOVE
...