### COCI 2006/2007, Contest #1

## Task BOND

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, Jimmy Bonds. Bond (James Bond) has grown weary of having to distribute assign missions to 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 for 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 will result in the **greatest** probability that all missions are completed successfully.

**Note:** the probability of all missions being completed successfully is equal to the product of the probabilities of the single missions being completed successfully.

### Input

The first line will contain an integer N, the number of Jimmy Bonds and missions (1 ≤ N ≤ 20).

The following N lines will contain N integers between 0 and 100, inclusive. The j^{th} integer on the i^{th} line is the probability that Jimmy Bond i would successfully complete mission j, given as a percentage.

### Output

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

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

### Sample Tests

## Input2 100 100 50 50 ## Output50.000000 |
## Input2 0 50 50 0 ## Output25.00000 |
## Input3 25 60 100 13 0 50 12 70 90 ## Output9.10000 |

**Clarification of the third example:** If Jimmy bond 1 is assigned the 3^{rd} mission, Jimmy Bond 2 the 1^{st} mission and Jimmy Bond 3 the 2^{nd} mission the probability is: 1.0 * 0.13 * 0.7 = 0.091 = 9.1%. All other arrangements give a smaller probability of success.

All Submissions

Best Solutions

**Point Value:** 10 (partial)

**Time Limit:** 2.00s

**Memory Limit:** 32M

**Added:** Jan 13, 2009

**Languages Allowed:**

C++03, PAS, C, HASK, ASM, RUBY, PYTH2, JAVA, PHP, SCM, CAML, PERL, C#, C++11, PYTH3

## Comments (Search)

bryan2828on Mar 13, 2015 - 7:01:15 pm UTC REwhat does it means?

sigkillon Mar 13, 2015 - 8:55:45 pm UTC Re: REOne of the particular challenges of this problem is memory optimization. If you look at the comment below yours, you'll see that I went down the same path as you about 6 months ago. :)

sigkillon Aug 02, 2014 - 8:39:56 pm UTC No love for DP? :(xiaowuc1on Aug 02, 2014 - 10:05:52 pm UTC Re: No love for DP? :(