CSES - Datatähti 2018 loppu - Results
Submission details
Task:Merkkijono
Sender:Kurns
Submission time:2018-01-18 17:10:30 +0200
Language:Python2
Status:READY
Result:0
Feedback
groupverdictscore
#10
Test results
testverdicttime
#10.06 sdetails
#20.05 sdetails
#30.06 sdetails
#40.06 sdetails
#50.07 sdetails

Code

import time
UI = raw_input()
operaatiot = []
siirrot = 0
lista = []

for x in range(0, len(UI)):
    lista.append(UI[x])
    
def arvo(x):
    if x == "A":
        return 0
    if x == "B":
        return 1
    if x == "C":
        return 2
    if x == "D":
        return 3
    if x == "E":
        return 4
    if x == "F":
        return 5
    if x == "G":
        return 6
    if x == "H":
        return 7
    if x == "I":
        return 8
    if x == "J":
        return 9
    if x == "K":
        return 10
    if x == "L":
        return 11
    if x == "M":
        return 12
    if x == "N":
        return 13
    if x == "O":
        return 14
    if x == "P":
        return 15
    if x == "Q":
        return 16
    if x == "R":
        return 17
    if x == "S":
        return 18
    if x == "T":
        return 19
    if x == "U":
        return 20
    if x == "V":
        return 21
    if x == "W":
        return 22
    if x == "X":
        return 23
    if x == "Y":
        return 24
    if x == "Z":
        return 25

print lista
while UI[0] != "A" and UI[-1] != "Z":
    elif arvo(UI[0]) > arvo(UI[-1]):
        print "moved"
        lista.insert(0, UI[-1])
        del lista[-1]
        operaatiot.append("MOVE")
        siirrot += 1
    if arvo(UI[0]) > arvo(UI[-1]):
        print "swapped"
        eka = lista[0]
        toka = lista[1]
        lista[1] = eka
        lista[0] = toka
        operaatiot.append("SWAP")
        siirrot += 1
    print lista
    time.sleep(2)
        
print siirrot

for c in range(0, len(operaatiot)):
    print operaatiot[c]

Test details

Test 1

Verdict:

input
ABCDEFGHIJKLMNOPQRSTUVWXYZ

correct output
0

user output
(empty)

Error:
File "input/code.py", line 66
    elif arvo(UI[0]) > arvo(UI[-1]):
       ^
SyntaxError: invalid syntax

Test 2

Verdict:

input
ZYXWVUTSRQPONMLKJIHGFEDCBA

correct output
923
MOVE
MOVE
SWAP
MOVE
...

user output
(empty)

Error:
File "input/code.py", line 66
    elif arvo(UI[0]) > arvo(UI[-1]):
       ^
SyntaxError: invalid syntax

Test 3

Verdict:

input
RPJMFWBHYQOTXUAENLDGZISCVK

correct output
611
SWAP
MOVE
MOVE
SWAP
...

user output
(empty)

Error:
File "input/code.py", line 66
    elif arvo(UI[0]) > arvo(UI[-1]):
       ^
SyntaxError: invalid syntax

Test 4

Verdict:

input
GWJSPBHANMXYFLKIDORVUCEZQT

correct output
659
MOVE
SWAP
MOVE
SWAP
...

user output
(empty)

Error:
File "input/code.py", line 66
    elif arvo(UI[0]) > arvo(UI[-1]):
       ^
SyntaxError: invalid syntax

Test 5

Verdict:

input
BJYNFLKEIUCZMQHRAXOGWPSDTV

correct output
624
MOVE
SWAP
MOVE
SWAP
...

user output
(empty)

Error:
File "input/code.py", line 66
    elif arvo(UI[0]) > arvo(UI[-1]):
       ^
SyntaxError: invalid syntax