(Unofficial Editorial) 899C — Dividing the numbers

Правка en1, от shreybatra, 2018-01-09 19:45:51

Problem link — here

I found the editorial for this problem a little over the head. It made the question a little too complicated. I did it in a more easy way just by having two buckets S1 and S2. Start the series in descending order, to prevent some side cases and optimise the solution. Here is the logic: For each element i (1 <= i <= N), if the sum(S1)<=sum(S2), add the element in S1 or else add it in S2. At the end, all I had to do was calculate absolute difference of sum(S1)-sum(S2).

Cheers..!

solution link — here

Теги #899c, #452, #editorial

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский shreybatra 2018-01-09 19:45:51 700 Initial revision (published)