本文主要是介绍[贪心] cf883K Road Widening,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
@(ACM题目)[贪心]
Description
Mayor of city S just hates trees and lawns. They take so much space and there could be a road on the place they occupy!
The Mayor thinks that one of the main city streets could be considerably widened on account of lawn nobody needs anyway. Moreover, that might help reduce the car jams which happen from time to time on the street.
The street is split into n equal length parts from left to right, the i-th part is characterized by two integers: width of road si and width of lawn gi.
For each of n parts the Mayor should decide the size of lawn to demolish. For the i-th part he can reduce lawn width by integer xi (0 ≤ xi ≤ gi). After it new road width of the i-th part will be equal to s’i = si + xi and new lawn width will be equal to g’i = gi - xi.
On the one hand, the Mayor wants to demolish as much lawn
这篇关于[贪心] cf883K Road Widening的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!