Wrong Answer
Code
#include<bits/stdc++.h>
#define int long long
using namespace std;
signed main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
// freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
int t;
cin >> t;
while(t-->0){
int n;
string a, b;
cin >> n;
cin >> a;
cin >> b;
string aa = "",bb="";
aa += a;
bb += b;
for(int i = aa.size() - 1; i > 0; --i){
if(aa[i] != bb[i]){
if(aa[i] == '1'){
aa[i] = '0';
aa[i - 1] = '1';
}else{
aa[i] = '1';
aa[i - 1] = '0';
}
}
}
for(int i = 0; i + 1 < n; ++i){
if(a[i] != b[i]){
if(a[i] == '1'){
a[i] = '0';
a[i + 1] = '1';
}else{
a[i] = '1';
a[i + 1] = '0';
}
}
}
if(a == b || aa == bb)cout << "YES\n"; else cout << "NO\n";
}
return 0;
}
Information
- Submit By
- Type
- Submission
- Problem
- P1233 B. Make Binary Strings Equal
- Contest
- Happy New Year 2026
- Language
- C++11 (G++ 13.2.0)
- Submit At
- 2026-01-06 15:56:00
- Judged At
- 2026-01-06 15:56:00
- Judged By
- Score
- 0
- Total Time
- 2ms
- Peak Memory
- 532.0 KiB