POJ 1251
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <queue>
#include <ctime>
using namespace std;
#define LL long long
const int N = 2000;
const int INF = 1 << 30;
struct Node
{
int v,next,w;
bool operator < (const Node &a) const
{
return w > a.w;
}
} p[N],t1,t2;
int dis[N],vis[N],head[N],cnt;
int res;
void addedge(int u,int v,int w)
{
p[cnt].v = v;
p[cnt].next = head[u];
p[cnt].w = w;
head[u] = cnt++;
}
void prim()
{
priority_queue<Node> q;
for(int i = head[0] ; i != -1 ; i = p[i].next)
{
int v = p[i].v;
if(p[i].w < dis[v])
{
dis[v] = p[i].w;
t1.w = dis[v];