详见:http://blog.sina.com.cn/s/blog_676070110100rult.html
//308K
79MS
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <queue>
#define VM 1005
#define EM 10010
using namespace std;
const int inf = 0x3f3f3f3f;
int head[VM],cnt[VM][2],dist[VM][2],vis[VM][2];
int e,src,des,n,m;
struct E
{
int
to,w,nxt;
} edge[EM];
void addedge (int cu,int cv,int cw)
{
edge[e].to =
cv;
edge[e].w =
cw;
edge[e].nxt
= head[cu];
head[cu] = e
+......
阅读全文