/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 532.0 KiB
#2 Accepted 1ms 468.0 KiB
#3 Accepted 2ms 532.0 KiB
#4 Accepted 2ms 324.0 KiB
#5 Accepted 2ms 320.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, x = 0;
    string s, s1;

    cin >> n >> s >> s1;

    for (int i = 0; i < s1.length(); i++) {
        if (s1[i] == '1') {
            x++;
        }
    }
    if ((x == 0 || x == n) && s != s1) {
        cout << "NO";
    } else {
        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:52:00
Judged At
2026-01-06 15:52:00
Judged By
Score
100
Total Time
2ms
Peak Memory
532.0 KiB