Rating changes for last rounds are temporarily rolled back. They will be returned soon. ×

humbertoyusta's blog

By humbertoyusta, history, 5 years ago, In English

Hello I been recently solved this problem and I found a greedy solution and I don't know why is ok. I hope that any of you could explain me why it works or show me that it should not Here is my code http://mirror.codeforces.com/contest/1132/submission/51950554

  • Vote: I like it
  • +25
  • Vote: I do not like it

»
5 years ago, # |
  Vote: I like it +10 Vote: I do not like it

It shouldn't work. Consider summing to 45 with 8 8s and 8 7s available. Your code considers sums to 40 (5 8s), 39 (4 8s 1 7), 42 (6 7s), and 43 (6 7s 1 8). The correct answer is 45, consisting of 3 7s and 3 8s.