Problem Solving Ideas:
Think of every time a missile can be fired as a launcher, a total of n * m, and then a two-point answer
#include <iostream> #include <cstring> #include <cstdlib> #include <cstdio> #include <cmath > #include <string.h> #include <vector> #include <queue> #include <math.h> #include <set > #include <map> #include <stack> #define LL long long#define for (i, X, y) for (int i=x;i<=y;i++) using name Space Std;const Double EPS = 1e-8;const int maxn = 2500 + 10;int vis[maxn];vector<int>g[60];int MATCH[MAXN];d ouble t [MAXN] [60];struct point{int x, y;} A[MAXN], B[maxn];int N, m;double t1, T2, v;double dis (point A, point B) {double x = a.x-b.x; Double y = a.y-b.y; return sqrt (x * x + y * y);} int path (int u) {int sz = g[u].size (); for (int i=0;i<sz;i++) {int v = g[u][i]; if (!vis[v]) {vis[v] = 1; if (match[v] = = 1 | | path (MATCH[V])) {Match[v] = u; return 1; }}} return 0;} int Maxmatch () {int res = 0; memset (Match,-1, sizeof (match)); for (int i=0;i<m;i++) {memset (Vis, 0, sizeof (VIS)); Res + = path (i); } return res; Double D[maxn][60];int Main () {while (scanf ("%d%d%lf%lf%lf", &n, &m, &t1, &t2, &v)!=eof) { T1/= 60; For (i, 0, m-1) scanf ("%d%d", &b[i].x, &B[I].Y); For (i, 0, n-1) scanf ("%d%d", &a[i].x, &A[I].Y); for (int i=0;i<n;i++) {for (int j=0;j<m;j++) d[i][j] = Dis (a[i], b[j]); } for (k, 0, M-1) {for (I, 0, n-1) {for (j, 0, M-1) { T[I*M+K][J] = k * T2 + (k+1) * t1 + d[i][j]/V; }}} Double L = 0, r = 2000000000000.0; while (r-l >= EPS) {Double mid = (L + r) * 0.5; for (int i=0;i<60;i++) g[i].clear (); for (int i=0;i<n*m;i++) {for (int j=0;j<m;j++) {if (T[i][j] <= mid) g[j].push_back (i); }} if (Maxmatch () = = m) {r = Mid; } else L = mid; } printf ("%.6lf\n", R); } return 0;}
ZOJ 3460 Missile (binary + binary graph matching)