Meaning of the questions: n mice, m hole, s second escape, escape velocity v, a hole can only keep a mouse, the minimum number of mice to be caught eagle.
Solution: find out what each rat hole can save your life, the establishment of a bipartite graph, calculate the maximum matching, is not seeking to keep the life of a mouse, but seeking the number of rats caught .
#include<stdio.h> #include<iostream> #include<algorithm> #include<cstring> #include<math.h> #include<string> #include<map> #include<queue> #include<stack> #include<set> #define ll long long #define inf 0x3f3f3f3f using namespace std; int n,m; double s,v; vector<int>a[105]; ]; 105Show [boolint par[105]; struct node { double x; double y; }; node w[105];///老鼠位置 node h[105];///洞口位置 double dis( int i,int j ) { return sqrt( (w[i].x-h[j].x)*(w[i].x-h[j].x) + (w[i].y-h[j].y)*(w[i].y-h[j].y) ); } bool dfs(int x) { int len=a[x].size(); for(int i=0; I <len; I ++ ) { int Next = A [X] [I]; /// reach the hole IF ! (VIS [Next]) /// The deep searches are not accessed { VIS [Next ] = to true ; IF (! PAR [Next] || DFS (PAR [Next])) /// this hole not occupied by a mouse or other occupation of the rat hole to find other hole { PAR [Next] = X; /// occupiers next to x, for later backtracking return to true ; } } } return to false ; } int main () { the while (Scanf ("%d %d %lf %lf",&n,&m,&s,&v)!=EOF) { memset(par,0,sizeof(par));///清空操作 for(int i=1;i<=n;i++) a[i].clear(); for(int i=1;i<=n;i++) scanf("%lf%lf",&w[i].x,&w[i].y); for(int i=1;i<=m;i++) scanf("%lf%lf",&h[i].x,&H [I] .y); Double D = S * V; /// escape distance for ( int I = . 1 ; I <= n-; I ++ ) { for ( int J = . 1 ; J <= m; J ++ ) { IF (DIS (I, J) <= D) /// hole is smaller than the distance to escape from a [I] .push_back (J); } } int ANS = 0 ; for ( int I = . 1 ; I <= n- ; I ++ ) { Memset (VIS, to false , the sizeof(VIS)); IF (! DFS (I)) /// each question is intended to see a lot of hair wa ANS ++ ; } the printf ( " % D \ n- " , ANS); } return 0 ; }