/ SeriousOJ /

Record Detail

Accepted


  

Code

#include <bits/stdc++.h>
using namespace std;
#define ll long long 

#ifdef LOCAL
#include "debug.h"
#else
#define dbg(...)
#endif

void solve() {    
    int n;
	string s,p;
    cin >> n >> s >> p;
	
	if(n==1){
		cout << (s != p ? "NO" : "YES" ) << endl;
		return;
	}

	int p_one = count(p.begin(),p.end(),'1');
	int p_zero = count(p.begin(),p.end(),'0');

	if(p_zero >0 && p_one >0){
		cout << "NO" << endl;
		return;
	}
	
	cout << "YES" << endl;

}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);

    int t; cin >> t;while (t--)
    solve();
    return 0;
} 

Information

Submit By
Type
Pretest
Problem
P1233 B. Make Binary Strings Equal
Language
C++17 (G++ 13.2.0)
Submit At
2026-01-06 16:52:18
Judged At
2026-01-06 16:52:18
Judged By
Score
0
Total Time
0ms
Peak Memory
0 Bytes