#10213. ograda
ograda
本题没有可用的提交语言。
题目描述
有n个高度互不相同的木板。你需要用它们顺次连接拼成一段篱笆。并且每两
 个相邻位置的木板的高度的大小关系已知。一段篱笆的美观度定义为每两个相邻
 位置的木板的高度差的绝对值之和。 求一种木板放置顺序使得在满足给
 定的大小关系的基础上使得美观度尽量大。 
  
  
4  5 7 4 9  1 2 3 4
7  2 4 1 3
数据范围与约定
 
 First sample description: Mirko bought boards of heights 1, 2, 3 and 4. Fences similar to Slavko’s 
 that he can build are: 
 {1,3,2,4} - niceness 2+1+2=5 
    {1,4,2,3} - niceness 3+2+1=6 
    {2,3,1,4} - niceness 1+2+3=6 
     {2,4,1,3} - niceness 2+3+2=7 
    {3,4,1,2} - niceness 1+3+1=5
n <= 300,000.