I need help with some problem.

Revision en4, by peacebringer167, 2023-11-12 18:33:01

Hi guys, as the title stated, I really need some help with a problem (It appeared in my country's OI years ago). I remember it being a problem on Codeforces, the statement goes something like this:

Given N knowledges, numbered from 1 to N, each knowledge i has a cost of S[i] for you to be proficient in it. There are M tests, for each test from 1 to M, it gives you A[i] money, but it has a set of knowledges that require you to be proficient in all of it. Calculate the maximum benefit, if you learn knowledges optimally. For example,
N = 5
1 2 2 1 3
M = 4
A[1] = 2, knowledge requirements of 1 : (1,2)
A[2] = 5, knowledge requirements of 2 : (2,3)
A[3] = 1, knowledge requirements of 3 : (5)
A[4] = 1, knowledge requirements of 4 : (1)

The maximum benefit will be 3, since you learn knowledges (1,2,3) costs 1+2+2 = 5, and the tests 1,2,4 will give you 2+5+1 = 8 profit — cost = 8 — 5 = 3

Thanks for any help in advance!!!

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en4 English peacebringer167 2023-11-12 18:33:01 12 (published)
en3 English peacebringer167 2023-11-12 18:32:35 114
en2 English peacebringer167 2023-11-12 18:31:55 184 (saved to drafts)
en1 English peacebringer167 2023-11-12 18:30:34 984 Initial revision (published)