/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 34ms 17.34 MiB
#2 Wrong Answer 40ms 17.703 MiB
#3 Wrong Answer 80ms 20.23 MiB

Code

for _ in range(int(input())):
    n = int(input())
    s = input()
    p = input()
    for i in range(n):
        if s[i] != p[i]:
            if p[i] == '0':
                if not ((i != 0 and p[i - 1] == '1') or (i != n - 1 and p[i + 1] == '1')):
                    print('NO')
                    break
            elif not ((i != 0 and p[i - 1] == '0') or (i != n - 1 and p[i + 1] == '0')):
                print('NO')
                break
    else:
        print("YES")

Information

Submit By
Type
Submission
Problem
P1233 B. Make Binary Strings Equal
Contest
Happy New Year 2026
Language
PyPy 3 (Python 3.9.18 PyPy 7.3.15)
Submit At
2026-01-06 14:42:05
Judged At
2026-01-06 14:42:05
Judged By
Score
0
Total Time
80ms
Peak Memory
20.23 MiB