CSES - Datatähti 2018 loppu - Results
Submission details
Task:Merkkijono
Sender:ufokurpitsa
Submission time:2018-01-18 17:06:12 +0200
Language:Python3
Status:READY
Result:0
Feedback
groupverdictscore
#10
Test results
testverdicttime
#1ACCEPTED0.09 sdetails
#20.10 sdetails
#30.07 sdetails
#40.10 sdetails
#50.09 sdetails

Code

d = {'A': 0,
     'B': 1,
     'C': 2,
     'D': 3,
     'E': 4,
     'F': 5,
     'G': 6,
     'H': 7,
     'I': 8,
     'J': 9,
     'K': 10,
     'L': 11,
     'M': 12,
     'N': 13,
     'O': 14,
     'P': 15,
     'Q': 16,
     'R': 17,
     'S': 18,
     'T': 19,
     'U': 20,
     'V': 21,
     'W': 22,
     'X': 23,
     'Y': 24,
     'Z': 25,
     }

s1 = input()
s = []
for c in s1:
    s.append(c)

o = 0
m = []

for i in range(26):
    if d.get(s[i]) == 1:
        o = i
        break

for i1 in range(1,26):
    if d.get(s[(i1+o)%26]) != i1:
        for i in range(1, 26-i1):
            if d.get(s[(i1+i+o)%26]) != i1:
                for k in reversed(range(i)):
                    for j in range(26-((i1+k+o-1)%26)):
                        o += 1
                        m.append(False)
                    t = s[(i1+k+o)%26]
                    s[(i1+k+o)%26] = s[(i1+k+o+1)%26]
                    s[(i1+k+o+1)%26] = t
                    m.append(True)
      
for x in m:
    if x:
        print("SWAP")
    else:
        print("MOVE")

Test details

Test 1

Verdict: ACCEPTED

input
ABCDEFGHIJKLMNOPQRSTUVWXYZ

correct output
0

user output
MOVE
MOVE
MOVE
MOVE
MOVE
...

Test 2

Verdict:

input
ZYXWVUTSRQPONMLKJIHGFEDCBA

correct output
923
MOVE
MOVE
SWAP
MOVE
...

user output
MOVE
MOVE
SWAP
MOVE
MOVE
...

Test 3

Verdict:

input
RPJMFWBHYQOTXUAENLDGZISCVK

correct output
611
SWAP
MOVE
MOVE
SWAP
...

user output
MOVE
MOVE
MOVE
MOVE
MOVE
...

Test 4

Verdict:

input
GWJSPBHANMXYFLKIDORVUCEZQT

correct output
659
MOVE
SWAP
MOVE
SWAP
...

user output
MOVE
MOVE
MOVE
MOVE
MOVE
...

Test 5

Verdict:

input
BJYNFLKEIUCZMQHRAXOGWPSDTV

correct output
624
MOVE
SWAP
MOVE
SWAP
...

user output
MOVE
MOVE
MOVE
MOVE
MOVE
...