05 2012 档案

摘要:题意:每个顶点有一个权值,求构造一个图,使得 ∑(每个点的权值)X(到1结点的距离) 最小方法:dijkstra+heap昨晚写了一个,不知道为什么TLE,怎么改都TLE。今天重写一遍AC了#include<cstdio>#include<queue>#include<cstring>using namespace std;#define MAXN 50005#define MAXM 100005#define INF 10000000000int edge_cnt;int val[MAXN];int first[MAXN];struct edge_node 阅读全文
posted @ 2012-05-05 09:43 laputastar 阅读(253) 评论(0) 推荐(0)