Task: | Merkkijono |
Sender: | Kameli |
Submission time: | 2018-01-18 14:18:45 +0200 |
Language: | Python3 |
Status: | READY |
Result: | 100 |
group | verdict | score |
---|---|---|
#1 | ACCEPTED | 100 |
test | verdict | time | |
---|---|---|---|
#1 | ACCEPTED | 0.09 s | details |
#2 | ACCEPTED | 0.09 s | details |
#3 | ACCEPTED | 0.09 s | details |
#4 | ACCEPTED | 0.07 s | details |
#5 | ACCEPTED | 0.07 s | details |
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 ... |