You are not logged in. Please login at to post your questions!


codeforces educational round

could anyone suggest a simpler stategy for solving the problem:

asked 21 Sep '17, 23:22

viralivora's gravatar image

accept rate: 14%

Just brute-force it, since $N$ is very small. ($N<= 50$)


answered 21 Sep '17, 23:50

bazsi700's gravatar image

accept rate: 7%

You can use 2D DP and Sorting.

Here is link to my solution.

At any point, you can choose to find the difference between adjacent numbers or you can leave it.You must remember that you can leave atmost 2 numbers.


answered 22 Sep '17, 11:35

anushi's gravatar image

accept rate: 15%


You need to minimize total instability,

so, firstly sort the array with respect to weight of person.

Now traverse this sorted array to find the maximum absolute difference between two consequtive people.

These two people will sit on single kayaks.(No contribution to instability.)

And remaining people will be divided in groups of two.
(Note : These groups will be consecutive divisions of two people each ,from the same array excluding the ones alloted with single kayaks.)
So, the sum of the absolute difference of their weights of each group is the required total instability.


answered 22 Sep '17, 00:03

shawnfrost's gravatar image

accept rate: 14%

toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported
  • mathemetical formulas in Latex between $ symbol

Question tags:


question asked: 21 Sep '17, 23:22

question was seen: 318 times

last updated: 22 Sep '17, 11:35