Brewing potion 5 - MarisaOJ: Marisa Online Judge

Brewing potion 5

Time limit: 1000 ms
Memory limit: 256 MB
Marisa has n×2 mushrooms and she wants to brew n potion bottles, each using exactly 2 mushrooms. If the ith mushroom is paired with the jth mushroom, the resulting potion has a power of Ai,j. Marisa wants to find the combination of mushrooms that maximizes the total power of the n potion bottles. ### Input - The first line contains an integer n. - The next n×2 lines, i-th line contains n×2 integers Ai,j. It is guaranteed that Ai,j=Aj,i. ### Output - Print the maximum total power of n potion bottles. ### Constraints - 1≤n≤10. - 0≤|Ai,j|≤106. ### Example Input: 10-2-20 Output: -2