Compile Error
foo.cc: In function 'int main()':
foo.cc:23:12: error: 's' was not declared in this scope
23 | if(s[i]==s[i-1]||p[i]==p[i-1]){
| ^
foo.cc:23:26: error: 'p' was not declared in this scope
23 | if(s[i]==s[i-1]||p[i]==p[i-1]){
| ^
Code
#include <bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin >> t;
while (t--)
{
int n;
string s1,s2;
cin>>n>>s1>>s2;
if(s1==s2){
cout<<"YES"<<endl;
continue;
}
if(n==1){
cout<<"NO"<<endl;
continue;
}
bool y=false;
for(int i=1;i<n;i++){
if(s[i]==s[i-1]||p[i]==p[i-1]){
y=true;
break;
}
}
if(y)cout<<"YES"<<endl;
else cout<<"NO"<<endl;
}
}
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:42:29
- Judged At
- 2026-01-06 15:42:29
- Judged By
- Score
- 0
- Total Time
- 0ms
- Peak Memory
- 0 Bytes