题目链接: http://acm.hust.edu.cn/vjudge/problem/356795 Racing Gems Time Limit: 3000MS 问题描述 You are playing a racing game. Your character starts at the x axis (y = 0) and proceeds up the race track, which has a boundary at the line x = 0 and another at x…
FatMouse's Speed Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 20784 Accepted Submission(s): 9220Special Judge Problem Description FatMouse believes that the fatter a mouse is, the faster…
在所有避难所都有至少一只队伍的情况,总移动距离最小. 把队伍的位置和人都排序. 会发现,对于最后一个队伍i和最后一个避难所j, Case 1:pos[j]>=pos[i],那么i是距离j最近的一只队伍, Case 2:pos[j]<pos[i],那么j是距离i最近的一个避难所. dp[i][j]表示第i个人,第j个避难所非空的最小总距离. 转移:对于第i个人,只需要往j走就好了. Case 1,如果i走到最近的避难所j',那么必须要有i之前的某个i'走到j,不会更优. Case 2,直接贪心.…