Изменения рейтингов за последние раунды временно удалены. Скоро они будут возвращены. ×

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

Автор YQCMMD, 11 лет назад, По-английски

Link of my submission

I can't figure it out why my solution got WA. I have read the Tutorial. And my idea is a little different, but I think it's a valid solution. My idea goes like that:

sum = sigma a[i]. do : a[i] = sum — a[i];

and we put all this numbers(a[i]) into a priority_queue. everytime pop out all the smallest one.(maybe more than 1) and count the number(cnt) of smallest one. and if cnt is multiple of x^b(b can't be larger any more) we push a number (smallest number + b) into the priority_queue. and do that again. if cnt is not a multiple of x, then we get the ans we want. (actually ans = min(cnt, sum))

Anyone can tell me why my solution is not correct. Thanks a lot.

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

»
11 лет назад, # |
  Проголосовать: нравится +4 Проголосовать: не нравится

I fixed yours solution. Try to understand why it was wrong 5095663

  • »
    »
    11 лет назад, # ^ |
      Проголосовать: нравится +5 Проголосовать: не нравится

    Well,thank you sincerely. And I think I know why it's wrong. The part of cnt that can't be divided by k still useful and cause a effect to the other numbers. I just left it behind. Thank you again.