#P1791. [国家集训队] 人员雇佣
[国家集训队] 人员雇佣
Description
As a business-savvy tycoon, Xiao decides to hire some of the best managers in his country to run his company. There is a collaboration contribution index among these managers (we use to denote how well manager knows manager ). That is, when manager and manager are both hired, manager contributes to manager , increasing the profit by .
Of course, hiring each manager costs some money . For some managers, their contribution may not be worth the cost, so, being smart, Xiao will not hire them. However, those who are not hired will be hired by competitors. In that case, they will affect the work of the managers you hire, decreasing the profit by (note: this is the same as above).
Being efficiency-first, Xiao wants to hire some people to maximize the net profit. Can you help Xiao solve this problem?
Input Format
- The first line contains an integer , the number of managers.
- The second line contains integers , the cost to hire each manager.
- The next lines each contain numbers, giving , i.e., how well manager knows manager . It holds that .
Output Format
The first line contains one integer, the maximum value.
3
3 5 100
0 6 1
6 0 2
1 2 0
1
Hint
- For 20% of the testdata, .
- For 50% of the testdata, .
- For 100% of the testdata, , , .
From Lin Yankai.
Translated by ChatGPT 5
京公网安备 11011102002149号