Wrong Answer
Code
def isPossibleToConvert(s, p, n):
if s == p:
return True
if n == 1:
return False
if n == 2:
return p not in ['00', '11']
curS = s[0]
for i in range(n):
if p[i] == curS:
curS = s[i + 1] if i + 1 < n else None
continue
curS = '1' if p[i] == '0' else '0'
return curS is None
t = int(input())
for _ in range(t):
n = int(input())
s = input()
p = input()
print("YES" if isPossibleToConvert(s, p, n) else "NO")
Information
- Submit By
- Type
- Submission
- Problem
- P1233 B. Make Binary Strings Equal
- Contest
- Happy New Year 2026
- Language
- Python 3 (Python 3.12.3)
- Submit At
- 2026-01-06 15:19:26
- Judged At
- 2026-01-06 15:19:26
- Judged By
- Score
- 0
- Total Time
- 15ms
- Peak Memory
- 3.082 MiB