/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 536.0 KiB
#2 Accepted 1ms 532.0 KiB
#3 Accepted 2ms 532.0 KiB
#4 Accepted 2ms 320.0 KiB
#5 Accepted 2ms 532.0 KiB

Code

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define all(x) (x).begin(), (x).end()
#define f(i, n) for (int i = 0; i < n; i++)
#define trace(x) cerr << #x << ": " << x << '\n'
int n;
string s, t;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int tt;
    cin >> tt;
    while (tt--)
    {
        cin >> n >> s >> t;
        int f11 = 0, f00 = 0, f10 = 0;
        f(i, n - 1)
        {
            if (s[i] == '1' and s[i + 1] == '1')
                f11 = 1;
            if (s[i] == '0' and s[i + 1] == '0')
                f00 = 1;
            if (s[i] != s[i + 1])
                f10 = 1;
        }
        if (s == t)
        {
            cout << "YES\n";
            continue;
        }
        if (n == 1)
        {
            cout << "NO\n";
            continue;
        }
        sort(all(t));
        if (t[0] == t.back())
            cout << "NO\n";
        else
            cout << "YES\n";

    end:;
    }

    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 16:46:41
Judged At
2026-01-06 16:46:41
Judged By
Score
100
Total Time
2ms
Peak Memory
536.0 KiB