Tag-最短路

Icontofig 's Blog // 我们的征程是星辰大海！Away From OI，Come to ICPC（查看友链请点About Me）

2019-02-26 20:08:10 |  0 Comments  |  最短路

代码

```#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <set>
using namespace std;
sets1;
sets2;
const int maxn = 2e5+5;
struct edge{
int to,next;
}e[maxn];
int h[maxn];
int dis[maxn];
int T,n,m,S,u,v,cnt;
int get_num(){
int num = 0;
char c;
bool flag = false;
while((c = getchar()) == ' ' || c == '\r' || c == '\n');
if(c == '-')
flag = true;
else num = c - '0';
while(isdigit(c = getchar()))
num = (((num<<2)+num)<<1) + c - '0';
return (flag ? -1 : 1) * num;
}
void init(){
for(int i = 1;i <= n;++i){
h[i] = -1;
dis[i] = -1;
}
cnt = 0;
}
void add(int u,int v){
e[cnt].to = v;
e[cnt].next = h[u];h[u] = cnt++;
return;
}
void BFS(int s){
for(int i = 1;i <=```
2019-02-14 10:43:38 |  0 Comments

Description

Innocent Wu follows Dumb Zhang into a ancient tomb. Innocent Wu’s at the entrance of the tomb while Dumb Zhang’s at the end of it. The tomb is made up of many chambers, the total number is N. And there are M channels connecting the chambers. Innocent Wu wants to catch up Dumb Zhang to find out the answers of some questions, however, it’s Dumb Zhang’s intention to keep Innocent Wu in the dark, to do which he has to stop Innocent Wu from getting him. Only via the original shortest ways from the entrance to the end of the tomb costs the minimum time, and that’s the only chance Innocent Wu can catch Dumb Zhang.
Unfortunately, Dumb Zhang masters the art of becoming invisible(奇门遁甲) and tricks devices of this tomb, he can cut off the connections between chambers by using them. Dumb Zhang wanders how many channels at least he has to cut to stop Innocent Wu. And Innocent Wu wants to know after how many channels at most Dumb Zhang cut off Innocent Wu still has the chance to catch Dumb

2019-02-13 09:33:40 |  0 Comments

B - A <= c     (1)
C - B <= a     (2)
C - A <= b     (3)
如果要求C-A的最大值，可以知道max（C-A）= min(b,a+c),而这正对应了下图中C到A的最短路。

http://www.cnblogs.com/g0feng/archive/2012/09/13/2683880.html

2016-12-11 21:25:50 |  1 Comments

Title - Artist
0:00