/ 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 536.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;
        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 == t)
        {
            cout << "YES\n";
            continue;
        }
        if (n == 1)
        {
            cout << "NO\n";
            continue;
        }
        int c1 = count(all(s), '1');
        int c2 = count(all(t), '1');
        if (c1 == c2)
        {
            cout << "YES\n";
            continue;
        }
        if(c1>c2 and f11)
        {
            cout<<"YES\n";
            continue;
        }
        if(c1<c2 and f00)
        {
            cout<<"YES\n";
            continue;
        }
        cout<<"NO\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:04:46
Judged At
2026-01-06 16:04:46
Judged By
Score
0
Total Time
2ms
Peak Memory
536.0 KiB