Блог пользователя 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
  • Проголосовать: не нравится