/* written by Pankaj Kumar. country:-INDIA */ #include #include #include using namespace std; using namespace __gnu_pbds; typedef long long ll ; typedef vector vl; typedef vector> vvl; #define speed cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(0); /* Abbrevations */ #define ff first #define ss second #define mp make_pair #define line cout<()) // some extra #define printv(v) for(ll i=0;i,rb_tree_tag,tree_order_statistics_node_update> class Codeforces{ private: // read only variable const ll INF=1e18; const ll mod1=1e9+7; const ll mod2=998244353; public: Codeforces(){ } ll power(ll x,ll y){ ll result=1; while(y>0){ if(y&1){ result*=x; } y>>=1; x*=x; } return result; } ll power(ll x,ll y,ll mod){ ll result=1; x%=mod; while(y>0){ if(y&1){ result*=x; result%=mod; } y>>=1; x*=x; x%=mod; } return result; } ll str_to_num(string s){ stringstream pk(s); ll num; pk>>num; return num; } string num_to_str(ll num){ return to_string(num); } // Techniques : // divide into cases, brute force, pattern finding // sort, greedy, binary search, two pointer // transform into graph // Experience : // Cp is nothing but only observation and mathematics. ll solve(){ ll n; string s; cin>>n>>s; if(n&1){ no return 0; } else{ ll one=0,zero=0; for(auto x:s){ if(x=='0'){ zero++; } else{ one++; } } ll required=n/2; if(zero==required){ yes cout<<1<<" "<zero){ ll diff=one-zero; diff/=2; ll count=0; // here we need a range l,r such that it have x zero and x+diff one for(ll i=0;i=0;i--){ if(s[i]=='1'){ count++; } else{ count--; } if(count==diff){ yes cout<=0;i--){ if(s[i]=='0'){ count++; } else{ count--; } if(count==diff){ yes cout<>TestCase; while(TestCase--){ Codeforces cf; cf.solve(); } } /* -----------------END OF PROGRAM --------------------*/ /* * stuff you should look before submission * constraint and time limit * int overflow * special test case (n=0||n=1||n=2) * don't get stuck on one approach if you get wrong answer */