• [1144] Line of Position

  • 时间限制: 1000 ms 内存限制: 65535 K
  • 问题描述
  • Now input a positive number n,then you can get n numbers from 1 to n,they are all different and they are in a wrong queue,so you should arrangement them from small to large.The condition is that you can only change two adjacent numbers.
  • 输入
  • Input until EOF.
    Input a positive number n(3<=n<=2000) the first line.
    Then in the next line followed n numbers about 1 to n.
  • 输出
  • You should output the minimum times you make them from small to large.
  • 样例输入
  • 5
    1 5 2 3 4
    5
    1 5 3 4 2
  • 样例输出
  • 3
    5
  • 提示
  • 来源
  • hungar
  • 操作

显示春菜