UVa1599 - Ideal Path

#include
#include
#include
#include
using namespace std;
const int maxn=100010;
const int inf=1<<30;
int n,vis[maxn],d[maxn];
vector g[maxn],ans;
struct way{
    int u,v,c;
    way(int u=0,int v=0,int c=0):u(u),v(v),c(c){}
};
vector ways;
void build(int u,int v,int c){
    ways.push_back(way(u,v,c));
    int i=(int)ways.size()-1;
    g[u].push_back(i);

}
void rev_bfs(){
    memset(vis,0,sizeof(vis));
    d[n-1]=0;
    vis[n-1]=true;
    queueq;
    q.push(n-1);
    while(!q.empty()){

        int v=q.front();
        q.pop();
        for(int i=0;inext;
    next.push_back(0);
    for(int i=0;i next2;
    for(int j=0;j

你可能感兴趣的:(UVA)