Блог пользователя Purendra_

Автор Purendra_, история, 4 месяца назад, По-английски

https://codeforces.com/contest/1914/problem/C

Consider the following case,

3 10 4 8 4 2 9 10

Out of the choices to use the 3rd quest are either (4) or (9), greedy would ideally choose 9 but if you keep choosing 9 over 4 we end up with the answer as 84 rather than 86

4 > 8 > 9 > 9 > 9 > 9 > 9 > 9 > 9 > 9 = 84 4 > 8 > 4 > 10 > 10 > 10 > 10 > 10 > 10 > 10 = 86

How is it tagged as greedy?

Полный текст и комментарии »

  • Проголосовать: нравится
  • -2
  • Проголосовать: не нравится