Language: C++

#include<bits/stdc++.h>
using namespace std;
#define nn 100008*2
#define lf double
#define mp make_pair
#define ll long long
#define err return 0;
set<int> p1[2];
int ans[nn];
char buf[nn];
int status[nn];
int fork[nn];
int to[nn];int n;int tot;
#define ui p1[t]
int vis[nn];
int check()
{
	return 1;
	for(int i=0;i<n;i++) if(!ans[i]) return 0;
	int now=-1;
//	for(int i=0;i<=n;i++) cout<<to[i];
	while(1)
	{
		cout<<now;
		if(now==n) break; 
		vis[now+1]=1;
		now=to[now+1];
		if(!now) break;
	}
	for(int i=1;i<=n;i++) if(vis[i]!=status[i]) return 0;
	return 1;
}
int  solve()
{
	tot=0;
	p1[0].clear(),p1[1].clear();
	memset(to,0,sizeof(to));memset(ans,0,sizeof(ans));
//	cout<<p1[0].size();
	if(p1[0].size() or p1[1].size()) err;
	for(int i=0;i<=n;i++) if(fork[i+1]==0) p1[status[i]].insert(i);
		for(int i=0;i<=n;i++)
	{
		if(fork[i+1]==0 and ans[i]==0)
		{
			int t=status[i];
			ui.erase(i);
			if(!ui.size()) err;
			int nxt=*ui.begin();
			ui.erase(nxt);
			t=i;
			to[t]=nxt,to[nxt]=t;
			ans[nxt]=ans[t]=++tot;
		}
	}
	if(p1[0].size() or p1[1].size()) err;
	
	
	
	for(int i=0;i<=n;i++) if(fork[i+1]==1) p1[status[i]].insert(i);
	if(p1[0].size()!=p1[1].size()) err;
	int u0=p1[0].size()/2;
	int u1=p1[0].size()-u0;
	set<int> waste;
	while(u0--) waste.insert(*p1[0].begin()),p1[0].erase(p1[0].begin());
	while(u1--) waste.insert(*p1[1].begin()),p1[1].erase(p1[1].begin());
//	cout<<waste.size();
	for(int i=0;i<=n;i++)
	{
	//	if(!waste.count())
		if(fork[i+1]==1 and ans[i]==0 and waste.count(i))
		{
		//	cout<<i;
			int t=status[i];
			t=!t;
			if(!ui.size()) err;
			int nxt=*ui.begin();//god damn it how to arrange ranges?
			ui.erase(nxt);
			t=i;
//			cout<<t<<"-"<<nxt<<"\n";
			to[t]=nxt,to[nxt]=t;
			ans[nxt]=ans[t]=++tot;
	//		cout<<t<<nxt;
		}
	}
	
	
	return 1;
}
int main()
{
	scanf("%d",&n);n=n*2-1;
	scanf("%s",buf+1);
	for(int i=1;i<=n;i++) status[i]=buf[i]-'0';status[0]=1;
	fork[0]=1;for(int i=1;i<=n;i++) fork[i]=status[i]^status[i-1];
	fork[n+1]=1;
	if(solve()&&check())
	{
		puts("Yes");
		for(int i=0;i<=n;i++) printf("%d ",ans[i]);
		exit(0);
	}
	fork[n+1]=0;
	if(solve()&&check())
	{
		puts("Yes");
		for(int i=0;i<n;i++) printf("%d ",ans[i]);
		exit(0);
	}
	puts("No");
}

Compiler output:
a.cc:12:12: error: 'int fork [200016]' redeclared as different kind of entity
   12 | int fork[nn];
      |            ^
In file included from /usr/include/x86_64-linux-gnu/bits/sigstksz.h:24,
                 from /usr/include/signal.h:328,
                 from /usr/include/c++/14/csignal:42,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:116,
                 from a.cc:1:
/usr/include/unistd.h:778:16: note: previous declaration '__pid_t fork()'
  778 | extern __pid_t fork (void) __THROWNL;
      |                ^~~~
a.cc: In function 'int solve()':
a.cc:40:42: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   40 |         for(int i=0;i<=n;i++) if(fork[i+1]==0) p1[status[i]].insert(i);
      |                                          ^
cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith]
a.cc:43:28: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   43 |                 if(fork[i+1]==0 and ans[i]==0)
      |                            ^
cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith]
a.cc:59:42: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   59 |         for(int i=0;i<=n;i++) if(fork[i+1]==1) p1[status[i]].insert(i);
      |                                          ^
cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith]
a.cc:59:43: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   59 |         for(int i=0;i<=n;i++) if(fork[i+1]==1) p1[status[i]].insert(i);
      |                                  ~~~~~~~~~^~~
a.cc:70:28: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   70 |                 if(fork[i+1]==1 and ans[i]==0 and waste.count(i))
      |                            ^
cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith]
a.cc:70:29: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   70 |                 if(fork[i+1]==1 and ans[i]==0 and waste.count(i))
      |                    ~~~~~~~~~^~~
a.cc: In function 'int main()':
a.cc:94:15: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   94 |         fork[0]=1;for(int i=1;i<=n;i++) fork[i]=status[i]^status[i-1];
      |               ^
a.cc:94:16: error: assignment of read-only location '* fork'
   94 |         fork[0]=1;for(int i=1;i<=n;i++) fork[i]=status[i]^status[i-1];
      |         ~~~~~~~^~
a.cc:94:47: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   94 |         fork[0]=1;for(int i=1;i<=n;i++) fork[i]=status[i]^status[i-1];
      |                                               ^
a.cc:94:48: error: assignment of read-only location '*(fork + ((sizetype)i))'
   94 |         fork[0]=1;for(int i=1;i<=n;i++) fork[i]=status[i]^status[i-1];
      |                                         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
a.cc:95:17: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   95 |         fork[n+1]=1;
      |                 ^
cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith]
a.cc:95:18: error: assignment of read-only location '*(fork + (((sizetype)n) + 1))'
   95 |         fork[n+1]=1;
      |         ~~~~~~~~~^~
a.cc:102:17: warning: pointer to a function used in arithmetic [-Wpointer-arith]
  102 |         fork[n+1]=0;
      |                 ^
cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith]
a.cc:102:18: error: assignment of read-only location '*(fork + (((sizetype)n) + 1))'
  102 |         fork[n+1]=0;
      |         ~~~~~~~~~^~