Accepted
Code
#include<bits/stdc++.h>
using namespace std;
/*
* @author abhishek
*
*/
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int tt;
cin>>tt;
while(tt--) {
int n;
cin>>n;
string s, p;
cin>>s>>p;
if(s==p) {
cout<<"YES"<<endl;
continue;
}
if(n==1) {
cout<<"NO"<<endl;
continue;
}
bool one = true;
bool zero= true;
for(auto it:p) {
if(it=='1') {
zero= false;
}
if(it=='0') {
one= false;
}
}
if(one ||zero) {
if(s==p) {
cout<<"YES"<<endl;
} else{
cout<<"NO"<<endl;
}
} else{
cout<<"YES"<<endl;
}
}
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:39:19
- Judged At
- 2026-01-06 15:39:19
- Judged By
- Score
- 100
- Total Time
- 7ms
- Peak Memory
- 532.0 KiB