Task: | Merkkijono |
Sender: | Kurns |
Submission time: | 2018-01-18 14:06:48 +0200 |
Language: | Python2 |
Status: | READY |
Result: | 0 |
group | verdict | score |
---|---|---|
#1 | WRONG ANSWER | 0 |
test | verdict | time | |
---|---|---|---|
#1 | ACCEPTED | 0.06 s | details |
#2 | WRONG ANSWER | 0.06 s | details |
#3 | TIME LIMIT EXCEEDED | -- | details |
#4 | TIME LIMIT EXCEEDED | -- | details |
#5 | TIME LIMIT EXCEEDED | -- | details |
Code
# -*- coding: utf-8 -*- """ Created on Thu Jan 18 13:15:33 2018 @author: guest407 """ UI = raw_input() lista = [] operaatiot = [] siirrot = 0 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 def swap(i1, i2): ai1 = str(lista[int(i1)]) ai2 = str(lista[int(i2)]) lista[i2] = ai1 lista[i1] = ai2 operaatiot.append("SWAP") def vikaekaksi(): vika = str(lista[-1]) lista.insert(0,vika) del[lista[-1]] operaatiot.append("MOVE") while lista[0] != "A" and lista[-1] != "Z": if arvo(lista[0]) > arvo(lista[1]): swap(0,1) elif arvo(lista[-1]) < arvo(lista[0]): vikaekaksi() siirrot += 1 print siirrot #for c in range(0, len(operaatiot)): #print operaatiot[c]
Test details
Test 1
Verdict: ACCEPTED
input |
---|
ABCDEFGHIJKLMNOPQRSTUVWXYZ |
correct output |
---|
0 |
user output |
---|
0 |
Test 2
Verdict: WRONG ANSWER
input |
---|
ZYXWVUTSRQPONMLKJIHGFEDCBA |
correct output |
---|
923 MOVE MOVE SWAP MOVE ... |
user output |
---|
2 |
Test 3
Verdict: TIME LIMIT EXCEEDED
input |
---|
RPJMFWBHYQOTXUAENLDGZISCVK |
correct output |
---|
611 SWAP MOVE MOVE SWAP ... |
user output |
---|
(empty) |
Test 4
Verdict: TIME LIMIT EXCEEDED
input |
---|
GWJSPBHANMXYFLKIDORVUCEZQT |
correct output |
---|
659 MOVE SWAP MOVE SWAP ... |
user output |
---|
(empty) |
Test 5
Verdict: TIME LIMIT EXCEEDED
input |
---|
BJYNFLKEIUCZMQHRAXOGWPSDTV |
correct output |
---|
624 MOVE SWAP MOVE SWAP ... |
user output |
---|
(empty) |