=.=好菜 #include <iostream> #include <cstdio> #include <string.h> #include <cstring> #include <queue> using namespace std; ; +; typedef long long ll; const ll INF = 1e15; int n,m,head[N],rehead[N],tot; struct node { int v,w,nex…
Description "Good man never makes girls wait or breaks an appointment!" said the mandarin duck father. Softly touching his little ducks' head, he told them a story. "Prince Remmarguts lives in his kingdom UDF – United Delta of Freedom. One…
http://poj.org/problem?id=2449 Remmarguts' Date Time Limit: 4000MS   Memory Limit: 65536K Total Submissions: 18168   Accepted: 4984 Description "Good man never makes girls wait or breaks an appointment!" said the mandarin duck father. Softly tou…
题目 题意:求 点s 到 点t 的 第 k 短 路的距离: 估价函数=当前值+当前位置到终点的距离 f(n)=g(n)+h(n);     g(n)表示g当前从s到p所走的路径的长度,      h(n)'启发式函数',表示为终点t到其余一点p的路径长度: (1)将有向图的所有边反向,以原终点t为源点,求解t到所有点的最短距离;  (2)新建一个优先队列,将源点s加入到队列中;  (3)从优先级队列中弹出f(p)最小的点p,如果点p就是t,则计算t出队的次数;  如果当前为t的第k次出队,则当前…
题意:找出第k短路,输出长度,没有输出-1 思路:这题可以用A*做.A*的原理是这样,我们用一个函数:f = g + h 来表示当前点的预期步数,f代表当前点的预期步数,g代表从起点走到当前的步数,h代表从当前点走到终点的最短路,显然h可以用最短路解出.那么我们从起点开始找,每次找f最小的点,直到找到第k个这样的点. 代码: #include<queue> #include<cstring> #include<set> #include<map> #incl…
Remmarguts' Date Time Limit: 4000MS   Memory Limit: 65536K Total Submissions:35025   Accepted: 9467 Description "Good man never makes girls wait or breaks an appointment!" said the mandarin duck father. Softly touching his little ducks' head, he…
题目链接 Description "Good man never makes girls wait or breaks an appointment!" said the mandarin duck father. Softly touching his little ducks' head, he told them a story. "Prince Remmarguts lives in his kingdom UDF – United Delta of Freedom.…
题意 : 给出一个有向图.求起点 s 到终点 t 的第 k 短路.不存在则输出 -1 #include<stdio.h> #include<string.h> #include<queue> #include<algorithm> using namespace std; const int INF = 0x3f3f3f3f; ; ; struct EDGE{ int v, nxt, w; }; struct NODE{ int pos, Cost, F;…
Remmarguts' Date http://poj.org/problem?id=2449 Time Limit: 4000MS   Memory Limit: 65536K Total Submissions: 30772   Accepted: 8397 Description "Good man never makes girls wait or breaks an appointment!" said the mandarin duck father. Softly tou…
题目链接:http://poj.org/problem?id=2449 "Good man never makes girls wait or breaks an appointment!" said the mandarin duck father. Softly touching his little ducks' head, he told them a story. "Prince Remmarguts lives in his kingdom UDF – Unite…