/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 532.0 KiB
#2 Wrong Answer 2ms 536.0 KiB
#3 Wrong Answer 3ms 532.0 KiB

Code

// Author: Shawn Das Shachin-->(shawn_das)

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define pb push_back
#define mod 1000000007
#define srt(v) sort(v.begin(),v.end())
#define rsrt(v) sort(v.rbegin(),v.rend())
#define OPTIMIZE_IO ios::sync_with_stdio(false); cin.tie(nullptr);

void solve()
{
  int n;
  cin>>n;
  string s,p;
  cin>>s>>p;
  if(n==1){
    if(s==p)cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
  }
  else{
    int has1=false,has0=false;
    for(int i=0; i<n; i++){
        if(p[i]=='1'){
            has1=true;
        }
        else{
            has0=true;
        }
    }
    if(has1 && has0){
        cout<<"YES"<<endl;

    }
    else{
        if(s==p){
            cout<<"yes"<<endl;
        }
        else{
            cout<<"NO"<<endl;
        }
    }
  }
}

int main()
{
    OPTIMIZE_IO;
    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:49:38
Judged At
2026-01-06 14:49:39
Judged By
Score
0
Total Time
3ms
Peak Memory
536.0 KiB