On yesterdays Div3F

Revision en1, by ilovenoi, 2023-09-08 17:29:11

On yesterday's div3F, i've seen multiple solutions detailing this. 1872F - Selling a Menagerie

  1. Let's model it as how much index i get's affected if we sell i right now.
  2. Maintain it in a set.
  3. Always sell the index i that is least affected.

I get that we should always sell an index i that such that for all j, no Aj = i,

However, when there are some Aj = i, why is it optimal to sell the one that get's affected the least?

  1. How can we prove it's optimal
  2. Is it ever possible to sell another thing that is currently afraid of the minimum, thereby decreasing the minimum more, such that the sum of all affected will in fact be less.

Implementation details here. 222332183

Thanks for the help everyone!

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English ilovenoi 2023-09-08 17:29:11 754 Initial revision (published)