/ 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 544.0 KiB

Code

#include <bits/stdc++.h>
using namespace std;
     
const long long mod = 10000007;
const long long INF = LLONG_MAX;
const int N = 1001000;

void solve () {
    int n;
    string s, s1;

    cin >> n >> s1 >> s;

    if (n == 1) {
        if (s[0] != s[1]) {
            cout << "NO";
            return;
        }
    }
    if (s[n - 2] == '1' && s[n - 1] == '1') {
        if (s1[n - 2] != '1' || s1[n - 1] != '1') {
            cout << "NO";
            return;
        }
    } else if (s[n - 2] == '0' && s[n - 1] == '0') {
        if (s1[n - 2] != '0' || s1[n - 1] != '0') {
            cout << "NO";
            return;
        }
    }
    cout << "YES";
} 
int main () {
    ios::sync_with_stdio(false);
    cin.tie(nullptr); 

    long long t;
    cin >> t;

    while (t--) {
        solve();
        cout << "\n";
    }
    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 15:01:44
Judged At
2026-01-06 15:01:44
Judged By
Score
0
Total Time
2ms
Peak Memory
544.0 KiB