| Task: | Babaza Game |
| Sender: | aalto26am_024 |
| Submission time: | 2026-08-31 17:58:20 +0300 |
| Language: | Python3 (PyPy3) |
| Status: | READY |
| Result: | WRONG ANSWER |
| test | verdict | time | |
|---|---|---|---|
| #1 | ACCEPTED | 0.06 s | details |
| #2 | WRONG ANSWER | 0.06 s | details |
| #3 | ACCEPTED | 0.06 s | details |
| #4 | ACCEPTED | 0.06 s | details |
| #5 | WRONG ANSWER | 0.06 s | details |
| #6 | WRONG ANSWER | 0.06 s | details |
| #7 | WRONG ANSWER | 0.06 s | details |
| #8 | WRONG ANSWER | 0.06 s | details |
| #9 | WRONG ANSWER | 0.06 s | details |
| #10 | WRONG ANSWER | 0.06 s | details |
| #11 | WRONG ANSWER | 0.06 s | details |
| #12 | WRONG ANSWER | 0.06 s | details |
| #13 | WRONG ANSWER | 0.06 s | details |
| #14 | WRONG ANSWER | 0.06 s | details |
Code
from string import ascii_uppercase
s1 = input()
s2 = input()
n = len(s1)
print(s1)
s1 += ' '
s2 += ' '
wrong_idx = []
for i in range(len(s1)):
if s1[i] != s2[i]:
wrong_idx.append(i)
def find_char_not (strs):
for c in ascii_uppercase:
if c not in strs:
return c
intermediate = s1[:]
wrong_idx.append(n)
i = 0
while i < len(wrong_idx):
if i < len(wrong_idx) - 1 and wrong_idx[i+1] - wrong_idx[i] > 1:
# intermediate[wrong_idx[i]] = s2 [wrong_idx[i]]
intermediate = intermediate[:wrong_idx[i]] + s2 [wrong_idx[i]] + intermediate[wrong_idx[i] + 1:]
i += 1
elif i < len(wrong_idx) - 1 and s2[wrong_idx[i]] != s1[wrong_idx[i + 1]]:
# intermediate[wrong_idx[i]] = s2 [wrong_idx[i]]
intermediate = intermediate[:wrong_idx[i]] + s2 [wrong_idx[i]] + intermediate[wrong_idx[i] + 1:]
i += 1
elif i < len(wrong_idx) - 1 and s2[wrong_idx[i]] == s1[wrong_idx[i + 1]]:
if s2[wrong_idx[i + 1]] == s1[wrong_idx[i]]:
strs = []
strs.append(s2[wrong_idx[i]])
strs.append(s1[wrong_idx[i]])
if i + 2 < len(wrong_idx):
strs.append(s2[wrong_idx[i + 2]])
strs.append(s1[wrong_idx[i + 2]])
# intermediate[wrong_idx[i +1]] = find_char_not(strs)
# print('----', i)
# print(intermediate)
# print(find_char_not(strs))
intermediate = intermediate[:wrong_idx[i +1]] + find_char_not(strs) + intermediate[wrong_idx[i +1] + 1:]
# print(intermediate)
# print('----')
flag = True
i += 1
# print(i, '---0000')
else:
pass
i+=1
print(intermediate[:len(s2) - 1])
wrong_idx = []
for i in range(len(s2)):
if intermediate[i] != s2[i]:
wrong_idx.append(i)
intermediate_old = intermediate[:]
s1 = intermediate[:]
flag = False
wrong_idx.append(n)
i = 0
while i < len(wrong_idx):
if i < len(wrong_idx) - 1 and wrong_idx[i+1] - wrong_idx[i] > 1:
# intermediate[wrong_idx[i]] = s2 [wrong_idx[i]]
intermediate = intermediate[:wrong_idx[i]] + s2 [wrong_idx[i]] + intermediate[wrong_idx[i] + 1:]
i += 1
elif i < len(wrong_idx) - 1 and s2[wrong_idx[i]] != s1[wrong_idx[i + 1]]:
# intermediate[wrong_idx[i]] = s2 [wrong_idx[i]]
intermediate = intermediate[:wrong_idx[i]] + s2 [wrong_idx[i]] + intermediate[wrong_idx[i] + 1:]
i += 1
elif i < len(wrong_idx) - 1 and s2[wrong_idx[i]] == s1[wrong_idx[i + 1]]:
if s2[wrong_idx[i + 1]] == s1[wrong_idx[i]]:
strs = []
strs.append(s2[wrong_idx[i]])
strs.append(s1[wrong_idx[i]])
if i + 2 < len(wrong_idx):
strs.append(s2[wrong_idx[i + 2]])
strs.append(s1[wrong_idx[i + 2]])
# intermediate[wrong_idx[i +1]] = find_char_not(strs)
intermediate = intermediate[:wrong_idx[i +1]] + find_char_not(strs) + intermediate[wrong_idx[i +1] + 1:]
flag = True
i += 1
else:
pass
i+=1
if intermediate != intermediate_old:
print(intermediate[:len(s2) - 1])
if intermediate != s2:
print(s2[:len(s2) - 1])
Test details
Test 1
Verdict: ACCEPTED
| input |
|---|
| A B |
| correct output |
|---|
| A B |
| user output |
|---|
| A B |
Test 2
Verdict: WRONG ANSWER
| input |
|---|
| BABAZA BACBCB |
| correct output |
|---|
| BABAZA BACACA BACBCB |
| user output |
|---|
| BABAZA BACACA BACBCA 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 ABD ACD BCD |
Test 5
Verdict: WRONG ANSWER
| input |
|---|
| AXYB CXYD |
| correct output |
|---|
| AXYB CXYD |
| user output |
|---|
| AXYB CXYB CXYD |
Test 6
Verdict: WRONG ANSWER
| input |
|---|
| LMIJLF PAQBMH |
| correct output |
|---|
| LMIJLF PMQJMF PAQBMH |
| user output |
|---|
| LMIJLF PMQJMF PAQJMH PAQBMH |
Test 7
Verdict: WRONG ANSWER
| input |
|---|
| PNIWLSLIH CRLVPUFHD |
| correct output |
|---|
| PNIWLSLIH CNLWPSFID CRLVPUFHD |
| user output |
|---|
| PNIWLSLIH CNLWPSFID CRLWPUFID CRLVPUFHD |
Test 8
Verdict: WRONG ANSWER
| input |
|---|
| ZDYIAVTKL ZJKVXGAUM |
| correct output |
|---|
| ZDYIAVTKL ZJYVAGTUL ZJKVXGAUM |
| user output |
|---|
| ZDYIAVTKL ZJYVAGTUL ZJKVAGAUL ZJKVXGAUM |
Test 9
Verdict: WRONG ANSWER
| input |
|---|
| FBIXISJH NXZIESMG |
| correct output |
|---|
| FBIXISJH NBZXESMH NXZIESMG |
| user output |
|---|
| FBIXISJH NBZXESJG NXZXESMG NXZIESMG |
Test 10
Verdict: WRONG ANSWER
| input |
|---|
| OPGW QJIE |
| correct output |
|---|
| OPGW QPIW QJIE |
| user output |
|---|
| OPGW QPIW QJIW QJIE |
Test 11
Verdict: WRONG ANSWER
| input |
|---|
| DUKNPKQZBL NZPBMOEBIC |
| correct output |
|---|
| DUKNPKQZBL NUPNMKEZIL NZPBMOEBIC |
| user output |
|---|
| DUKNPKQZBL NUPNMKEZIL NZPNMOEZIC NZPBMOEBIC |
Test 12
Verdict: WRONG ANSWER
| input |
|---|
| ZWDTX HZOXI |
| correct output |
|---|
| ZWDTX HWOTI HZOXI |
| user output |
|---|
| ZWDTX HWOTI HZOTI HZOXI |
Test 13
Verdict: WRONG ANSWER
| input |
|---|
| URJF ITIQ |
| correct output |
|---|
| URJF IRIF ITIQ |
| user output |
|---|
| URJF IRIF ITIF ITIQ |
Test 14
Verdict: WRONG ANSWER
| input |
|---|
| WYWBWU IRYVBA |
| correct output |
|---|
| WYWBWU WRWVWA IRYVBA |
| user output |
|---|
| WYWBWU IYYBBU IRYBBA IRYVBA |
