YQCMMD's blog

By YQCMMD, 10 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.

Full text and comments »

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