将01,00,11,10分为四类,枚举每一类中第一组选的个数,我们只需要枚举10,11即可,另外两类可以简单推算出
vector<int>one,two,ow,no;
bool solve()
{
int n;cin>>n;
string s1,s2;cin>>s1>>s2;
rep(i,n)
{
if(s1[i]=='1'&&s2[i]=='0') one.push_back(i+1);//10
if(s1[i]=='0'&&s2[i]=='1') two.push_back(i+1);
if(s1[i]=='1'&&s2[i]=='1') ow.push_back(i+1);
if(s1[i]=='0'&&s2[i]=='0') no.push_back(i+1);
}
for(int a=0;a<=sz(one);++a)//10
{
for(int b=0;b<=sz(ow);++b)//11
{
int aa=sz(one)- a,bb=sz(ow) - b;
int cc=a+b-bb;
int c=sz(two)-cc,d=n/2-a-b-c;
int dd=sz(no) - d;
if(c<0||d<0) continue;
if(aa<0||bb<0||cc<0||dd<0||aa+bb+cc+dd!=a+b+c+d) continue;
rep(i,a) cout<<one[i]<<" ";
rep(i,b) cout<<ow[i]<<" ";
rep(i,c) cout<<two[i]<<" ";
rep(i,d) cout<<no[i]<<" ";
cout<<endl;
return 1;
}
}
return 0;
}
signed main()
{
fast;
if(!solve()) cout<<-1<<endl;
return 0;
}