这道题大致意思就是N个杯子的容积和茶壶的容积,要满足三个条件(1.每一个杯子里面的茶必须严格大于它容积的一半 2.茶壶往所有杯子到满水后没有生于地茶 3.所有的客人必须满意) 使客人满意的话,就是一个杯子里面的茶水必须大于任意一个容积小于它的杯子里面的茶水
Tea Party
Polycarp invited all his friends to the tea party to celebrate the holiday. He has n cups, one for each of his n friends, with volumes a1, a2, …, an. His teapot stores w milliliters of tea (w ≤ a1 + a2 + … + an). Polycarp wants to pour tea in cups in such a way that:
Every cup will contain tea for at least half of its volume
Every cup will contain integer number of milliliters of tea
All the tea from the teapot will be poured into cups
All friends will be satisfied.
Friend with cup i won’t be satisfied, if there exists such cup j that cup i contains less tea than cup j but ai > aj.
For each cup output how many milliliters of tea should be poured in it. If it’s impossible to pour all the tea and satisfy all conditions then outpu