| Task: | Babaza Game |
| Sender: | aalto26am_033 |
| Submission time: | 2026-09-01 00:06:05 +0300 |
| Language: | Python3 (PyPy3) |
| Status: | READY |
| Result: | RUNTIME ERROR |
| test | verdict | time | |
|---|---|---|---|
| #1 | ACCEPTED | 0.04 s | details |
| #2 | ACCEPTED | 0.04 s | details |
| #3 | ACCEPTED | 0.04 s | details |
| #4 | ACCEPTED | 0.04 s | details |
| #5 | ACCEPTED | 0.04 s | details |
| #6 | RUNTIME ERROR | 0.17 s | details |
| #7 | ACCEPTED | 0.04 s | details |
| #8 | RUNTIME ERROR | 0.16 s | details |
| #9 | ACCEPTED | 0.04 s | details |
| #10 | RUNTIME ERROR | 0.15 s | details |
| #11 | ACCEPTED | 0.04 s | details |
| #12 | ACCEPTED | 0.04 s | details |
| #13 | RUNTIME ERROR | 0.15 s | details |
| #14 | ACCEPTED | 0.04 s | details |
Code
def bestStep(start: str, goal: str):
print(start)
if start != goal:
oneMove = True
for i in range(0,len(start)-1):
oneMove = oneMove and (start[i] == goal[i] or start[i+1] == goal[i+1])
if oneMove:
return bestStep(goal,goal)
mustGoNext = [False for i in range(0,len(start))]
for i in range(0,len(start)-1):
mustGoNext[i+1] = mustGoNext[i+1] or (start[i+1] == goal[i])
mustGoNext[i] = mustGoNext[i] or (start[i] == goal[i+1])
for x in range(0,len(start)):
for i in range(0,len(start)):
if i+2 < len(start):
mustGoNext[i] = mustGoNext[i] or ((start[i] != goal[i]) and mustGoNext[i+2])
if i-2 >= 0:
mustGoNext[i] = mustGoNext[i] or ((start[i] != goal[i]) and mustGoNext[i-2])
twoMove = True
for i in range(0,len(start)-1):
twoMove = twoMove and not (mustGoNext[i] and mustGoNext[i+1])
free = list(set(list(map(chr, range(ord('A'), ord('Z')+1)))).difference(set(list(start)).union(set(list(goal)))))[0]
if twoMove:
def helper(i):
if mustGoNext[i]:
return goal[i]
else:
return start[i]
return bestStep(''.join([helper(i) for i in range(0,len(start))]),goal)
def helper2(i):
if ((i%2) == 1):
return free
else:
return start[i]
return bestStep(''.join([helper2(i) for i in range(0,len(start))]),goal)
bestStep(input(),input())
Test details
Test 1
Verdict: ACCEPTED
| input |
|---|
| A B |
| correct output |
|---|
| A B |
| user output |
|---|
| A B |
Test 2
Verdict: ACCEPTED
| input |
|---|
| BABAZA BACBCB |
| correct output |
|---|
| BABAZA BACACA BACBCB |
| user output |
|---|
| BABAZA BACACA BACBCB |
Test 3
Verdict: ACCEPTED
| input |
|---|
| AB BA |
| correct output |
|---|
| AB CB CA BA |
| user output |
|---|
| AB AC BC BA |
Test 4
Verdict: ACCEPTED
| input |
|---|
| ABC BCD |
| correct output |
|---|
| ABC DBD DCD BCD |
| user output |
|---|
| ABC AEC BED BCD |
Test 5
Verdict: ACCEPTED
| input |
|---|
| AXYB CXYD |
| correct output |
|---|
| AXYB CXYD |
| user output |
|---|
| AXYB CXYD |
Test 6
Verdict: RUNTIME ERROR
| input |
|---|
| LMIJLF PAQBMH |
| correct output |
|---|
| LMIJLF PMQJMF PAQBMH |
| user output |
|---|
| LMIJLF LMIJLF LMIJLF LMIJLF LMIJLF ... |
Error:
Traceback (most recent call last):
File "/box/input/code.py", line 42, in <module>
bestStep(input(),input())
File "/box/input/code.py", line 32, in bestStep
return bestStep(''.join([helper(i) for i in range(0,len(start))]),goal)
File "/box/input/code.py", line 32, in bestStep
return bestStep(''.join([helper(i) for i in range(0,len(start))]),goal)
File "/box/input/code.py", line 32, in bestStep
return bestStep(''.join([helper(i) for i in range(0,len(start))]),goal)
[Previous line repeated 1322 more times]
File "/box/input/code.py", line 3, in bestStep
print(start)
RecursionError: maximum recursion depth exceededTest 7
Verdict: ACCEPTED
| input |
|---|
| PNIWLSLIH CRLVPUFHD |
| correct output |
|---|
| PNIWLSLIH CNLWPSFID CRLVPUFHD |
| user output |
|---|
| PNIWLSLIH CNLWPSFID CRLVPUFHD |
Test 8
Verdict: RUNTIME ERROR
| input |
|---|
| ZDYIAVTKL ZJKVXGAUM |
| correct output |
|---|
| ZDYIAVTKL ZJYVAGTUL ZJKVXGAUM |
| user output |
|---|
| ZDYIAVTKL ZDYIAVTKL ZDYIAVTKL ZDYIAVTKL ZDYIAVTKL ... |
Error:
Traceback (most recent call last):
File "/box/input/code.py", line 42, in <module>
bestStep(input(),input())
File "/box/input/code.py", line 32, in bestStep
return bestStep(''.join([helper(i) for i in range(0,len(start))]),goal)
File "/box/input/code.py", line 32, in bestStep
return bestStep(''.join([helper(i) for i in range(0,len(start))]),goal)
File "/box/input/code.py", line 32, in bestStep
return bestStep(''.join([helper(i) for i in range(0,len(start))]),goal)
[Previous line repeated 1320 more times]
File "/box/input/code.py", line 3, in bestStep
print(start)
RecursionError: maximum recursion depth exceededTest 9
Verdict: ACCEPTED
| input |
|---|
| FBIXISJH NXZIESMG |
| correct output |
|---|
| FBIXISJH NBZXESMH NXZIESMG |
| user output |
|---|
| FBIXISJH NBZXESMH NXZIESMG |
Test 10
Verdict: RUNTIME ERROR
| input |
|---|
| OPGW QJIE |
| correct output |
|---|
| OPGW QPIW QJIE |
| user output |
|---|
| OPGW OPGW OPGW OPGW OPGW ... |
Error:
Traceback (most recent call last):
File "/box/input/code.py", line 42, in <module>
bestStep(input(),input())
File "/box/input/code.py", line 32, in bestStep
return bestStep(''.join([helper(i) for i in range(0,len(start))]),goal)
File "/box/input/code.py", line 32, in bestStep
return bestStep(''.join([helper(i) for i in range(0,len(start))]),goal)
File "/box/input/code.py", line 32, in bestStep
return bestStep(''.join([helper(i) for i in range(0,len(start))]),goal)
[Previous line repeated 1332 more times]
File "/box/input/code.py", line 3, in bestStep
print(start)
RecursionError: maximum recursion depth exceededTest 11
Verdict: ACCEPTED
| input |
|---|
| DUKNPKQZBL NZPBMOEBIC |
| correct output |
|---|
| DUKNPKQZBL NUPNMKEZIL NZPBMOEBIC |
| user output |
|---|
| DUKNPKQZBL NUPNMKEZIL NZPBMOEBIC |
Test 12
Verdict: ACCEPTED
| input |
|---|
| ZWDTX HZOXI |
| correct output |
|---|
| ZWDTX HWOTI HZOXI |
| user output |
|---|
| ZWDTX HWOTI HZOXI |
Test 13
Verdict: RUNTIME ERROR
| input |
|---|
| URJF ITIQ |
| correct output |
|---|
| URJF IRIF ITIQ |
| user output |
|---|
| URJF URJF URJF URJF URJF ... |
Error:
Traceback (most recent call last):
File "/box/input/code.py", line 42, in <module>
bestStep(input(),input())
File "/box/input/code.py", line 32, in bestStep
return bestStep(''.join([helper(i) for i in range(0,len(start))]),goal)
File "/box/input/code.py", line 32, in bestStep
return bestStep(''.join([helper(i) for i in range(0,len(start))]),goal)
File "/box/input/code.py", line 32, in bestStep
return bestStep(''.join([helper(i) for i in range(0,len(start))]),goal)
[Previous line repeated 1332 more times]
File "/box/input/code.py", line 3, in bestStep
print(start)
RecursionError: maximum recursion depth exceededTest 14
Verdict: ACCEPTED
| input |
|---|
| WYWBWU IRYVBA |
| correct output |
|---|
| WYWBWU WRWVWA IRYVBA |
| user output |
|---|
| WYWBWU WRWVWA IRYVBA |
