Binary Mismatch | BINMIS :- What is Wrong with my Approach?

What is wrong with my logic?

Problem Link:- Contest Page | CodeChef

void solve()
{
  int n;
  cin >> n;

  string s;
  cin >> s;


  if ( n & 1)
  {
    cout << "NO\n";
    return;
  }

  int ones = count(s.begin() , s.end() , '1');

  int zeroes = n - ones;

  if ( ones == zeroes)
  {
    cout << "YES\n";
    cout << 1 << " " << n << "\n";
    return;
  }

  if ( ones == n || zeroes == n)
  {
    cout << "YES\n";
    cout << 1 << " " << n/2 << "\n";
    return;
  }

  if (ones > zeroes)
  {
    cout << "YES\n";

    for (int i = 0 ; i < n ; i++)
    {
      if ( s[i] == '1')
      {
        cout << i+1 << " " << i+1 << "\n";
        return;
      }
    }
  }
  else
  {
    cout << "YES\n";

    for (int i = 0 ; i < n ; i++)
    {
      if ( s[i] == '0')
      {
        cout << i+1 << " " << i+1 << "\n";
        return;
      }
    }
  }
}

Check the following map-based c++ solution for hint about the error in your approach.

Accepted