Description: SOLDIERS
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Description
N soldiers of the land Gridland are randomly scattered around the country. A position in Gridland is given by a pair (x,y) of integer coordinates. Soldiers can move- in one move, one soldier can go one unit up, down, left or right (hence, he can change either his x or his y coordinate by 1 or-1). The soldiers want to get into a horizontal line next to each other (so that their final positions are (x,y), (x+1,y), ..., (x+N-1,y), for some x and y). Integers x and y, as well as the final order of soldiers along the horizontal line is arbitrary. The goal is to minimise the total number of moves of all the soldiers that takes them into such configuration. Two or more soldiers must never occupy the same position at the same time.
Input
The first line of the input contains the integer N, 1 <= N <= 10000, the number of soldiers. The following N lines of the input conta
To Search:
File list (Check if you may need any files):
Soldiers
........\Debug
........\.....\Soldiers.exe
........\.....\Soldiers.ilk
........\.....\Soldiers.obj
........\.....\Soldiers.pch
........\.....\Soldiers.pdb
........\.....\vc60.idb
........\.....\vc60.pdb
........\Soldiers.cpp
........\Soldiers.dsp
........\Soldiers.dsw
........\Soldiers.ncb
........\Soldiers.opt
........\Soldiers.plg
........\Soldiers思路.txt
........\题目.txt