Problem list
Log in
#coci00005 · COCI 2006/2007 Contest 1

Bond

Platinum V 0.6 s 32 MB

Everyone knows of the secret agent double-oh-seven, the popular Bond (James Bond). A lesser known fact is that he actually did not perform most of his missions by himself; they were instead done by his cousins, the Jimmy Bonds. Bond (James Bond) has grown weary of having to assign missions to the Jimmy Bonds every time he gets new missions, so he has asked you to help him out.

Every month Bond (James Bond) receives a list of missions. Using his detailed intelligence from past missions, for every mission and every Jimmy Bond he calculates the probability of that particular mission being successfully completed by that particular Jimmy Bond. Your program should process that data and find the arrangement that results in the greatest probability that all missions are completed successfully. Each Jimmy Bond is assigned exactly one mission, and each mission to exactly one Jimmy Bond.

Note: The probability that all missions are completed successfully equals the product of the probabilities of the individual missions being completed successfully.

Input

The first line contains an integer $N$, the number of Jimmy Bonds and the number of missions ($1 \le N \le 20$).

The following $N$ lines each contain $N$ integers between $0$ and $100$, inclusive. The $j$-th integer on the $i$-th line is the probability (given as a percentage) that Jimmy Bond $i$ would successfully complete mission $j$.

Output

Output the maximum probability of the Jimmy Bonds successfully completing all the missions, as a percentage.

Note: Outputs within $±0.000001$ of the official solution will be accepted.

Example 1

Input
2
100 100
50 50
Output
50.000000

Example 2

Input
2
0 50
50 0
Output
25.00000

Example 3

Input
3
25 60 100
13 0 50
12 70 90
Output
9.10000
Source
COCI 2006/2007 Contest 1
Appears in
Not part of a ladder, contest or set yet.
Accepted 1 Submissions 1 Acceptance 100% Solvers 1

Discussion

Threads about this problem. Spoilers are collapsed; wrap hints in ||double bars||.

No discussion yet. Start a thread if something here needs explaining.

Recent submissions Open with filters
Code