#P2460. [SDOI2007] 科比的比赛

[SDOI2007] 科比的比赛

Description

There are m+1m + 1 participants in total, including Kobe. Each of the other mm participants has an ability value sis_i. Kobe will play nn matches. In each match, he faces one opponent who has not been defeated before. Once Kobe defeats someone, that opponent will no longer participate.

Kobe’s probability of defeating a specific opponent varies by match index. Specifically, you are given an n×mn \times m matrix vi,jv_{i,j}, where vi,jv_{i,j} is the probability that Kobe defeats opponent jj if they meet in match ii.

Choose the opponent Kobe faces in each of the nn matches (without repetition) to maximize the probability that Kobe wins all nn matches. Subject to achieving this maximum probability (with an error not exceeding 101010^{-10}), maximize the sum of the ability values of the opponents that Kobe defeats.

Input Format

  • The first line contains two positive integers n,mn, m.
  • The second line contains mm integers, the ability values sis_i of the other mm participants.
  • Then follows an n×mn \times m matrix, the probabilities vi,jv_{i,j}.

Output Format

  • On the first line, output the maximum probability that Kobe wins all nn matches. The error must not exceed 101010^{-10}.
  • On the second line, output the maximum sum of ability values among all strategies that achieve the maximum probability.
3 4
91 92 93 94
0.5 0.5 0.5 0.5
0.5 0.5 0.5 0.5
0.5 0.5 0.5 0.5
0.125
279

Hint

Constraints

1n10,nm1051\le n\le 10, n \le m \le 10^5

1si100,0vi,j11\le s_i\le 100, 0\le v_{i,j}\le 1

This problem is Special Judge.

Translated by ChatGPT 5