Help me in solving SUSSTR problem

My issue

even after correct output I am getting as wrong answer

My code

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
void solve(string &s)
{
    ll n = s.length();
    vector<char> v;
    for(ll i=0,j=n-1;i<n/2,j>=n/2;i++,j--) // i position = Alice , j position = Bob
    {
            if(s[i]=='0') // Alice ith position insert , 0 -> begin (make small)
            v.insert(v.begin(),'0');
            else
            v.insert(v.end(),'1');
            if(s[j]=='1')     // Bob jth position insert, 1 -> begin (make large)
            v.insert(v.begin(),'1');
            else
            v.insert(v.end(),'0');
    }
   
    for(auto i:v)
     cout<<i<<"";
    cout<<"\n";
}
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll testcases;
    cin>>testcases;
    while(testcases--)
    {
       ll n;
       cin>>n;
       string s;
       cin>>s;
       solve(s);
       
    }
}







Learning course: Stacks and Queues
Problem Link: Suspense String Practice Problem in Stacks and Queues - CodeChef

@adi_1516
your code is wrong because u are incrementing and decrementing i and j simultaneously instead of alternatively .
plzz refer the following code

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

int main() {
	// your code goes here
	int t;
	cin>>t;
	while(t--)
	{
	    int n;
	    cin>>n;
	    string s;
	    cin>>s;
	    string ans;
	    for(int i=0,j=n-1,k=0;k<n;k++)
	    {
	        if(k%2==0)
	        {
	            if(s[i]=='0')
	            {
	                ans='0'+ans;
	            }
	            else
	            ans.push_back('1');
	            i++;
	        }
	        else
	        {
	            if(s[j]=='1')
	            {
	                ans='1'+ans;
	            }
	            else
	            ans.push_back('0');
	            j--;
	        }
	    }
	    cout<<ans<<endl;
	}

}