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

Автор vivekcrux, история, 5 лет назад, По-английски

Can anyone suggest how can I approach this problem:-
https://www.codechef.com/FFC22019/problems/FFC219A
I have looked at few submissions, most of them are using the similar type of approach, but I'm not able to understand the concept behind it. Any help is appreciated.

Полный текст и комментарии »

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

Автор vivekcrux, история, 5 лет назад, По-английски

Link to the problem:- Equal Average
I have tried to solve this question by rearranging the array in a way that a sequence of length k gets repeated so that the average of all k length subsequences is same. Now I need to place the elements in their appropriate positions and check whether any such sequence is possible or not. For that I have used priority_queue. The elements with greater occurrences will be placed first at separations of k.
Here's my submission, but it's giving wa, I don't know where I'm getting wrong. Any help would be appreciated.

Полный текст и комментарии »

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