Task: | Merkkijono |
Sender: | Jace |
Submission time: | 2018-01-18 12:49:02 +0200 |
Language: | Python3 |
Status: | READY |
Result: | 0 |
group | verdict | score |
---|---|---|
#1 | TIME LIMIT EXCEEDED | 0 |
test | verdict | time | |
---|---|---|---|
#1 | ACCEPTED | 0.07 s | details |
#2 | TIME LIMIT EXCEEDED | -- | details |
#3 | TIME LIMIT EXCEEDED | -- | details |
#4 | TIME LIMIT EXCEEDED | -- | details |
#5 | TIME LIMIT EXCEEDED | -- | details |
Code
values = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' string = list(input()) for i in range(len(string)): string[i] = values.index(string[i]) string = bytearray(string) ops = [] def swap(): global string ops.append('SWAP') string[0], string[1] = string[1], string[0] def move(): global string ops.append('MOVE') k = string[-1] for i in range(25, 0, -1): string[i] = string[i-1] string[0] = k target = bytearray(list(range(len(values)))) while True: if string[0] < string[1]: move() else: swap() for num, i in enumerate(string): if num != i: break else: break print(len(ops)) for op in ops: print(op) #print(string)
Test details
Test 1
Verdict: ACCEPTED
input |
---|
ABCDEFGHIJKLMNOPQRSTUVWXYZ |
correct output |
---|
0 |
user output |
---|
50 MOVE SWAP MOVE SWAP ... |
Test 2
Verdict: TIME LIMIT EXCEEDED
input |
---|
ZYXWVUTSRQPONMLKJIHGFEDCBA |
correct output |
---|
923 MOVE MOVE SWAP MOVE ... |
user output |
---|
(empty) |
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) |