Help me in solving PLAYSTR problem

My issue

help

My code

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

int main() {
int i,j,s,r,t,n,k;
int one,ones,zero,zeroes;
cin>>t;
for(i=0;i<t;i++){
   cin>>n;
   string s,r;
   cin>>s>>r;
   for(j=0;j<n;j++){
       if(s[j]=='1'){
           one++;
       }
       else{
           zero++;
       }
       for(k=0;k<n;k++){
           if(r[k]=='1'){
               ones++;
           }
           else{
               zeroes++;
           }
       }
   }
}
if(one==ones){
    cout<<"YES"<<endl;
}
else{
    cout<<"NO"<<endl;
}
}
}

Problem Link: Playing with Strings Practice Coding Problem

@lakshitsingh91
plzz refer the following code

#include <iostream>
using namespace std;

int main() {
	// your code goes here
	int t;
	cin>>t;
	while(t--)
	{
	    int n;
	    cin>>n;
	    string s,r;
	    cin>>s>>r;
	    int o=0,z=0;
	    for(int i=0;i<n;i++)
	    {
	        if(s[i]=='1')
	        o++;
	        else
	        z++;
	    }
	    for(int i=0;i<n;i++)
	    {
	        if(r[i]=='1')
	        o--;
	        else
	        z--;
	    }
	    if(o==0&&z==0)
	    cout<<"YES";
	    else
	    cout<<"NO";
	    cout<<endl;
	}
	return 0;
}