Description: BackgroundIn an old train station next to a bridge, the bridge can rotate around the river center pier horizontal rotation. One of the stations of the workers found the length of the bridge can accommodate up to two cars, if the bridge will be rotated 180 degrees, you can put two adjacent carriage position exchange, this method can be used to rearrange the order of carriage.He is responsible for this bridge will stop the compartments are arranged from small to large carriage number.After his retirement, train station decided to bring the work of automation, one of the most important work is to write a program, enter the initial compartment sequence, computing at least how many steps can be sorting compartments.InputInput file has two lines of data, the first line is the total number of N compartment ( less than 100000 ), the second line is N different numbers of initial compartment sequence.OutputA data, is the least number of rotation.
To Search:
File list (Check if you may need any files):
车厢重组\Debug\vc60.idb
........\.....\vc60.pdb
........\.....\车厢重组.exe
........\.....\车厢重组.ilk
........\.....\车厢重组.obj
........\.....\车厢重组.pch
........\.....\车厢重组.pdb
........\车厢重组.cpp
........\车厢重组.dsp
........\车厢重组.dsw
........\车厢重组.ncb
........\车厢重组.opt
........\车厢重组.plg
........\Debug
车厢重组