POJ 2253 Frogger(最小生成树)

题目链接:点击打开链接

题意:求从1到2的路径中, 使得最长路尽量小。

细节参见代码:

#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#define Max(a,b) ((a)>(b)?(a):(b))
#define Min(a,b) ((a)<(b)?(a):(b))
using namespace std;
typedef long long ll;
typedef long double ld;
const ld eps = 1e-9, PI = 3.1415926535897932384626433832795;
const int mod = 1000000000 + 7;
const int INF = int(1e9);
// & 0x7FFFFFFF
const int seed = 131;
const ll INF64 = ll(1e18);
const int maxn = 200 + 10;
int T,n,m,cnt,p[maxn],kase=0;
double ans[maxn][maxn],x[maxn],y[maxn];
struct node {
    int a, b;
    double dist;
    node(int a=0, int b=0, double dist=0):a(a), b(b), dist(dist) {}
    bool operator < (const node& rhs) const {
        return dist < rhs.dist;
    }
}a[maxn*maxn];
vector g[maxn];
int _find(int x) { return p[x] == x ? x : p[x] = _find(p[x]); }
void dfs(int u, int fa) {
    int len = g[u].size();
    for(int i=0;i


你可能感兴趣的:(POJ,图论,ACM竞赛)