Problem:
Problem G: Defend the Bases

A country Gizevom is being under a sneak and fierce attack by their foe. They have to deploy one or
more troops to every base immediately in order to defend their country. Otherwise their foe would take
all the bases and declare "All your base are belong to us."

You are asked to write a program that calculates the minimum time required for deployment, given the
present positions and marching speeds of troops and the positions of the bases.

Input

The input consists of multiple datasets. Each dataset has the following format:

N M

x1 y1 v1

x2 y2 v2

...

xN yN vN

x'1 y'1

x'2 y'2

...

x'M y'M

N is the number of troops (1 ≤ N ≤ 100); M is the number of bases (1 ≤ M ≤ 100); (xi, yi ) denotes the present position of i-th troop; vi is the speed of the i-th troop (1 ≤ vi ≤ 100); (x'j, y'j) is the position of the j-th base.

All the coordinates are integers between 0 and 10000 inclusive.

The last dataset is followed by a line containing two zeros. This line is not a part of any dataset and should not be processed.

Output

For each dataset, print the minimum required time in a line.

Sample Input

2 2
10 20 1
0 10 1
0 10
10 0
0 0

Output for the Sample Input

14.14213562

Solution in JAVA (judge verdict: Accepted)

import java.util.*;

import static java.lang.Math.*;
public class Main {
	final Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		new Main();
	}
	Main(){
		new AOJ2161();
	}
	class AOJ2161{
		AOJ2161(){
			while(sc.hasNext()){
				N=sc.nextInt();
				M=sc.nextInt();
				if((N|M)==0)	break;
				solve();
			}
		}
		int N,M;
		class Edge implements Comparable<Edge>{
			int f,t;
			double w;
			Edge(int f,int t,double w){
				this.f=f;	this.t=t;	this.w=w;
			}
			@Override public int compareTo(Edge o){
				if(this.w<o.w)	return -1;
				if(this.w>o.w)	return 1;
				return 0;
			}
		}
		void solve(){
			int[] x=new int[N],y=new int[N],s=new int[N];
			for(int i=0; i<N; ++i){
				x[i]=sc.nextInt();
				y[i]=sc.nextInt();
				s[i]=sc.nextInt();
			}
			ArrayList<Edge> es=new ArrayList<Edge>(N*M);
			// 0~N-1, N~N+N-1
			for(int i=0; i<M; ++i){
				int xx=sc.nextInt(),yy=sc.nextInt();
				for(int j=0; j<N; ++j){
					int a=x[j]-xx, b=y[j]-yy;
					es.add(new Edge(j, N+i, sqrt(a*a+b*b)/s[j]));
				}
			}
			Collections.sort(es);
			G=new ArrayList<ArrayList<Integer>>(N+M);
			for(int i=0; i<N+M; ++i)	G.add(new ArrayList<Integer>());
			double ans=0.0;
			for(Edge e:es){
				ans=e.w;
				G.get(e.f).add(e.t);
				G.get(e.t).add(e.f);
				int ret=bipartiteMatching(G, N+M);
//				System.out.println(ret+" "+ans);
				if(ret>=M)	break;
			}
			System.out.printf("%.8f\n", ans);
		}
		int[] match;
		boolean[] used;
		ArrayList<ArrayList<Integer>> G;
		int bipartiteMatching(ArrayList<ArrayList<Integer>> G,int V){
			this.G=G;
			match=new int[V];
			Arrays.fill(match, -1);
			used=new boolean[V];
			int ret=0;
			for(int v=0; v<V; ++v){
				if(match[v]<0){
					Arrays.fill(used, false);
					if(dfs(v))	++ret;
				}
			}
			return ret;
		}
		boolean dfs(int v){
			used[v]=true;
			for(int u: G.get(v)){
				int w=match[u];
				if(w<0 || !used[w] && dfs(w)){
					match[v]=u;
					match[u]=v;
					return true;
				}
			}
			return false;
		}
	}

}