The magic matrix of Captain Huang

Time Limit
5s
Memory Limit
32768KB
Judge Program
Standard
Ratio(Solve/Submit)
4.88%(2/41)
Description:

Captain Huang has a a matrix CN*M, each element E of CN*M is positive and no more than 10000000.But Huang hope that every element in this matrix is between L and U, L indicates the lowerbound and U indicates the upperbound of these elements. Captain Huang want you to help her figure out  if there exists N numbers a1, a2, … an and M numbers b1, b2, …, bm, which satisfies that after each elements in row-i multiplied with ai and each elements in column-j divided by bj,  every element in this matrix is between L and U.

Input:

There are several test cases. You should process to the end of file.
Each case includes two parts, in part 1, there are four integers in one line, N,M,L,U, indicating the matrix has N rows and M columns, L is the lowerbound and U is the upperbound (1<=N,M<=400,1<=L<=U<=10000). In part 2, there are N lines, each line includes M integers, and they are the elements of the matrix.(For each test case, each elements and L,U are a real number with precision up to eight decimal places)

Output:

If there is a solution print "YES", else print "NO".

Sample Input:
3 3 1 6
2 3 4
8 2 6
5 2 9
Sample Output:
YES

Submit