ilovenoi's blog

By ilovenoi, history, 15 months ago, In English

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!

Full text and comments »

  • Vote: I like it
  • -3
  • Vote: I do not like it