#include #include #include #include #include #include #include using namespace std; typedef pairEdge;//pairfirst,second; struct Node{ int cost; vector edge; bool operator<(const Node&node) const{ return(cost(const Node&node) const{ return(cost>node.cost); } /*Node a,b; a.cost=5; b.cost=3; a.operator<(b); //false=0 //a>n>>e; vector node(n+1); for(int i=0;i>from>>to>>cost; node[from].edge.push_back(Edge(cost,to)); node[to].edge.push_back(Edge(cost,from)); node[from].cost=INT_MAX; node[to].cost=INT_MAX; } /*priority_queue q; for(int i=1;i<=n;i++){ q.push(node[i]); } while(!q.empty()){ Node a; a=q.top(); q.pop(); cout<Edge; typedef pairNode; vector node; node[i].first; //コスト node[i].second[j].first; //j番目のエッジのコスト node[j].second[j].second; //j番目の接続先ノード */ priority_queue,greater > q; int start=0; node[start].cost=0; q.push(node[start]); while(!q.empty()){ Node done; done=q.top();//確定ノード q.pop(); for(int i=0;icost){ node[to].cost=cost; q.push(node[to]); } } } cout<