/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 768.0 KiB
#2 Wrong Answer 1ms 380.0 KiB
#3 Wrong Answer 2ms 404.0 KiB

Code

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

#define ll long long

void solve(){
    int n;
    string a, b, ta, tb;
    cin >> n >> a >> b;
    if(n < 2){
        cout << "NO\n";
        return;
    }else if(n == 2 && b[0] == b[1]){
        cout << "NO\n";
        return;
    }

    ta = a, tb = b;

    for(int i = 0 ; i < n ; i++){
        if(a[i] != b[i] && i < n - 1){
            if(b[i] == '1'){
                a[i] = '1', a[i+1] = '0';
            }else{
                a[i] = '0', a[i+1] = '1';
            }
        }
    }  


    cout << (a == b ? "YES\n" : "NO\n");
}

int main(){
    ios_base::sync_with_stdio(0), cin.tie(0);
    int t = 1;
    cin >> t;
    while(t--){
        solve();
    }
    return 0;
}

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:52:56
Judged At
2026-01-06 14:52:56
Judged By
Score
0
Total Time
2ms
Peak Memory
768.0 KiB