/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 532.0 KiB
#2 Wrong Answer 1ms 532.0 KiB
#3 Wrong Answer 2ms 532.0 KiB

Code

#include <bits/stdc++.h>
using namespace std;

#define endl '\n'
#define no cout << "NO" << endl
#define yes cout << "YES" << endl

void solve() {
    int n; 
    cin >> n;
    string x, y;
    cin >> x >> y;

    if (n == 1) {
        (x == y ? yes : no);
        return;
    }

    for (int i = 0; i + 1 < n; ++i) {
        if (y[i] == '0' && y[i + 1] == '0') {
            bool ok = false;

            if (i - 1 >= 0 && y[i - 1] == '1') ok = true;
            if (i + 2 < n && y[i + 2] == '1') ok = true;

            if (!ok) {
                no;
                return;
            }
        }
    }

    yes;
}

int32_t main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int t;
    cin >> t;
    while (t--) solve();
}

Information

Submit By
Type
Submission
Problem
P1233 B. Make Binary Strings Equal
Contest
Happy New Year 2026
Language
C++17 (G++ 13.2.0)
Submit At
2026-01-06 14:47:54
Judged At
2026-01-06 14:47:55
Judged By
Score
0
Total Time
2ms
Peak Memory
532.0 KiB