YQCMMD's blog

By YQCMMD, 11 years ago, In English

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.

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

»
11 years ago, # |
  Vote: I like it +4 Vote: I do not like it

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

  • »
    »
    11 years ago, # ^ |
      Vote: I like it +5 Vote: I do not like it

    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.