Language: C++

#include<bits/stdc++.h>
#define rep(i,a,b) for (int i=(a); i<=(b); i++)
#define SZ(v) ((int)v.size())
#define pb push_back
using namespace std;

const int maxn = 200005;
vector<int> li[maxn], id;
int n, m, L, ec, sum, mark[maxn];
char s[maxn];

void markit() {
    for (int i = 0; i << 2 < id.size(); i++) {
        for (int j : {0, 1}) 
        	for (int k : {0, 1})
        		mark[id[i << 2 | j << 1 | k]] = ec + k + 1;
        ec += 2;
    }
}

void output() {
    puts("Yes");
    for (int i = 0; i < L; i++) {
        if (!mark[i]) 
            mark[i] = ec < 0 ? -ec : ++ec, ec = -ec;
        printf("%d ", mark[i]);
    }
    exit(0);
}

int main() {
    scanf("%d%s", &n, s + 1);
    s[0] = '1'; L = n << 1;

    for (int i = 0, j; i < L; i++)
    	if (s[i] == '0' && s[(i + 1) % L] == '1') {
            for (li[m].pb(i), j = (i + 1) % L; s[j] == '1'; j = (j + 1) % L)
                li[m].pb(j);
            m++;
        }

    if (!m) {
        if (~n & 1) {
            for (int i = 0; i < L; i++) 
                id.pb(i);
            markit();
            output();
        }
        else puts("No"), exit(0);
    }
    for (int i = 0; i < m; i++) 
        sum += SZ(li[i]) - 2;
    if (sum & 1) {
        puts("No"), exit(0);
    }

    if (sum & 2) {
        for (int i = 0; i < m; i++)if (SZ(li[i]) > 2) 
                li[m - 1].swap(li[i]);
        for (int i = 0; i < m - 1; i++)if (SZ(li[i]) > 2) {
                VI&a = li[i], &b = li[m - 1];
                int la = SZ(a) - 1, lb = SZ(b) - 1, ea = a[la], eb = b[lb];
                mark[a[la - 1]] = mark[b[lb - 1]] = ++ec;
                a.pop_back(); b.pop_back();
                a.pop_back(); b.pop_back();
                a.push_back(eb);
                b.push_back(ea);
                sum -= 2;
                break;
            }
        if (sum & 2) puts("No"), exit(0);
    }

    for (int i = 0; i < m; i++) {
        mark[li[i][0]] = ec + 1 + i;
        mark[li[i][SZ(li[i]) - 1]] = ec + 1 + (i + 1) % m;

        for (int j = 1; j < SZ(li[i]) - 1; j++) {
            id.pb(li[i][j]);
        }
    }

    ec += m; markit(); output();
    return 0;
}
1

Compiler output:
a.cc: In function 'int main()':
a.cc:61:17: error: 'VI' was not declared in this scope
   61 |                 VI&a = li[i], &b = li[m - 1];
      |                 ^~
a.cc:61:20: error: 'a' was not declared in this scope
   61 |                 VI&a = li[i], &b = li[m - 1];
      |                    ^
a.cc:61:32: error: 'b' was not declared in this scope
   61 |                 VI&a = li[i], &b = li[m - 1];
      |                                ^
a.cc:63:42: error: 'lb' was not declared in this scope; did you mean 'la'?
   63 |                 mark[a[la - 1]] = mark[b[lb - 1]] = ++ec;
      |                                          ^~
      |                                          la
a.cc:66:29: error: 'eb' was not declared in this scope; did you mean 'ec'?
   66 |                 a.push_back(eb);
      |                             ^~
      |                             ec
a.cc:67:29: error: 'ea' was not declared in this scope; did you mean 'la'?
   67 |                 b.push_back(ea);
      |                             ^~
      |                             la
a.cc: At global scope:
a.cc:86:1: error: expected unqualified-id before numeric constant
   86 | 1
      | ^