티스토리 뷰

반응형


Difficulty : 4/10

I could'nt solve this problem during the contest.
but It is not difficult problem.

This problem is brute force.

first, you can try all combination of n-1 kayaks. but choosing 2 kayaks that soley drive is much easier. 

okay, then you could think about combination of n-1 tandem kayaks. here the greedy comes in. 
to minimize instability, you should choose two that have similar weight.
so, first you should sort all of them.


source code

https://github.com/ingyeoking13/algorithm/blob/master/cf/bruteforce/863B.c

반응형