这是一个最短路径的裸题,我们在边结构体中 添加成员路径和花费,然后在松弛操作的时候用这两个来松弛就OK
// AC 840k 109ms
#include
#include
using namespace std;
#define MAX 1001
#define IFN 1<<30-1
struct node
{
int to,len,cost,next;
}edge[MAX*100...
分类:
其他好文 时间:
2014-08-18 20:33:12
阅读次数:
155
题意:给定完全无向图,求其中m个子节点,要求Sum(edge)/Sum(node)最小。思路:由于N很小,枚举所有可能的子节点可能情况,然后求MST,memset()在POJ里面需要memory头文件。#include #include #include #include #include #inc...
分类:
其他好文 时间:
2014-08-18 18:30:52
阅读次数:
244
过了样例就能AC
注意一点 0条边特意判断下。是否无法构成生成树也要判断
#include
#include
#include
using namespace std;
#define maxn 110
int parent[maxn];
int N,M;
struct edge
{
int u,v,w;
}edges[maxn*maxn];
int cmp(void const *a,vo...
分类:
其他好文 时间:
2014-08-16 21:08:41
阅读次数:
190
to get the ans of how many roads at most that can be built between two line without intersection of roads,we need sort the input sequence at ont edge ...
分类:
其他好文 时间:
2014-08-16 17:01:30
阅读次数:
288
最短路与次短路条数#include #include #define N 10005#define INF 0x3f3f3f3fstruct Edge{ int u,val,next;}e[2*N];int p[N],vis[N][2],d[N][2],cnt[N][2];void add(i...
分类:
其他好文 时间:
2014-08-14 19:39:29
阅读次数:
263
次短路与条数#include #include #define N 10005#define INF 0x3f3f3f3fstruct Edge{ int u,val,next;}e[2*N];int p[N],vis[N][2],d[N][2],cnt[N][2];void add(int ...
分类:
其他好文 时间:
2014-08-14 19:32:29
阅读次数:
197
class Edge { enum Type { inner, outer, flat } Piece parent; Type type; boolean fitsWith(Edge type) { }; // Inners & outer f...
分类:
其他好文 时间:
2014-08-12 06:51:13
阅读次数:
208
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
using namespace std;
#define maxn 1000
#define INF 100000000
int edge[...
分类:
其他好文 时间:
2014-08-11 17:57:32
阅读次数:
197
HT for Web简称HT提供了涵盖通用组件、2D拓扑图形组件以及3D引擎的一站式解决方案,正如Hightopo官网所表达的我们希望提供:Everything you need to create cutting-edge 2D and 3D visualization. 这个愿景从功能...
分类:
其他好文 时间:
2014-08-11 08:29:50
阅读次数:
249
Problem H
Halum
Time Limit : 3 seconds
You are given a directed graph G(V,E) with a set of vertices and edges. Each edge (i,j) that connects some vertex i to vertex j has...
分类:
其他好文 时间:
2014-08-08 21:24:11
阅读次数:
570