#include <cstdio>
#include <cstring>
#include <cctype>
#include <vector>
#include <queue>
#include <iostream>
using namespace std;
const int NN=128;
const int INF=0x3fffffff;
int n,cnt1,cnt2,hash[NN],tmpf[NN],cur[NN],num[NN],tag[NN],w[NN][NN];
char id[NN];
bool single[NN];
vector<int> fav[NN];
int get()
{
int x;
char ch=getchar();
while (!isalpha(ch)) ch=getchar();
if (islower(ch))
{
x=ch-'a';
if (!hash[x])
{
hash[x]=++cnt1;
id[cnt1]=ch;
}
}
else
{
x=ch-'A'+26;
if (!hash[x])
{
hash[x]=++cnt2;
id[cnt2]=ch;
}
}
return hash[x];
}
void init()
{
scanf("%d",&n);
cnt1=0;
cnt2=n;
memset(hash,0,sizeof(hash));
for (int i=1; i<=n*2; i++) //男孩对应1~n号,女孩对应n+1~2*n号
{
int x=get();
fav[x].clear();
tag[x]=0;
w[x][0]=
POJ3487-稳定婚姻系统
最新推荐文章于 2021-02-26 16:11:47 发布