POJ1251
1393 ワード
//最近kuangbinさんについてクレイジーな水題(ORZ)
//Prime
#include
#include
#include
#define inf (0x3f3f3f3f)
using namespace std;
const int maxn = 35;
int Grape[maxn][maxn],d[maxn];
bool vis[maxn];
int n;//
int pre[maxn];
int Prime()
{
memset(d,inf,sizeof(d));
memset(pre,-1,sizeof(pre));
d[0] = 0;
while(true)
{
int mincost = inf,u = -1;
for(int v=0;v!=n;++v)
{
if(!vis[v]&&d[v]>n&&n)
{
memset(Grape,-1,sizeof(Grape));// u ~ v -1
memset(vis,false,sizeof(vis));
char u,v; int num,weight,sum = 0;//
for(int i=0;i!=n-1;++i)
{
cin>>u>>num;
while(num--)
{
cin>>v>>weight;
Grape[u-'A'][v-'A'] = Grape[v-'A'][u-'A'] = weight;
sum += weight;
}
}//
cout<