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

×

codeforces educational round

could anyone suggest a simpler stategy for solving the problem:http://codeforces.com/contest/863/problem/B

asked 21 Sep '17, 23:22

viralivora's gravatar image

4★viralivora
1838
accept rate: 14%


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

link

answered 21 Sep '17, 23:50

bazsi700's gravatar image

6★bazsi700
3758
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.

link

answered 22 Sep '17, 11:35

anushi's gravatar image

5★anushi
24617
accept rate: 15%

@viralivora

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.

link

answered 22 Sep '17, 00:03

shawnfrost's gravatar image

5★shawnfrost
966
accept rate: 14%

toggle preview
Preview

Follow this question

By Email:

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

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "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:

×2,403
×594
×283

question asked: 21 Sep '17, 23:22

question was seen: 318 times

last updated: 22 Sep '17, 11:35