| “壹零杯”第三届西华师范大学程序设计竞赛 |
|---|
| Finished |
Deep within the Astra ruins, Little A has discovered the core energy sources of $$$K$$$ ancient mechas. The energy value of the $$$j$$$-th core is $$$E_j$$$. Meanwhile, there are $$$N$$$ candidate pilots in Little A's expedition team. Each pilot has the following four attributes:
Since there are only $$$K$$$ mechas, Little A must strictly select $$$K$$$ elites from the $$$N$$$ candidate pilots. The selection sorting rules are as follows:
After selecting these $$$K$$$ elites, Little A needs to pair them one-to-one with the $$$K$$$ energy cores. When a pilot with Combat Power $$$C_i$$$ is assigned an energy core with energy value $$$E_j$$$, the combat effectiveness generated is $$$C_i \times E_j$$$.
Little A can freely decide the assignment of energy cores among the $$$K$$$ selected pilots. Please calculate the maximum total combat effectiveness the entire vanguard team can generate.
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10$$$) — the number of test cases.
For each test case: The first line contains two integers $$$N$$$ and $$$K$$$ ($$$1 \le K \le N \le 10^5$$$) — the number of candidate pilots and the number of mecha cores.
The next $$$N$$$ lines describe the pilots. The $$$i$$$-th line contains a string $$$Name_i$$$ ($$$1 \le |Name_i| \le 10$$$) and three integers $$$S_i, A_i, C_i$$$ ($$$1 \le S_i, A_i, C_i \le 10^5$$$). It is guaranteed that the names consist only of English letters and are pairwise distinct within the same test case.
The following line contains $$$K$$$ integers $$$E_1, E_2, \dots, E_K$$$ ($$$1 \le E_j \le 10^5$$$) — the energy values of the cores.
It is guaranteed that the sum of $$$N$$$ over all test cases does not exceed $$$2 \times 10^5$$$.
For each test case, output a single integer on a new line, representing the maximum total combat effectiveness.
23 2Alice 10 20 50Bob 10 20 40Charlie 15 10 3010 204 3David 100 100 10Eve 100 100 100Frank 100 90 500Grace 90 200 10005 2 10
13005520
| Name |
|---|


