Codeforces Round #757 (Div. 2) B. Divan and a New Project

Divan计划在坐标线上建造n+1座不同建筑物,要求坐标为整数且不重叠。Divan从建筑i到建筑j会花费|xi-xj|分钟。目标是选择建筑物的位置,在未来十年内使Divan的步行时间最小。题目提供输入包含建筑访问次数,需要输出最小步行时间和每个建筑的位置。
摘要由CSDN通过智能技术生成

题目链接:Problem - B - Codeforces

The company "Divan's Sofas" is planning to build n+1 different buildings on a coordinate line so that:

  • the coordinate of each building is an integer number;
  • no two buildings stand at the same point.

Let xixi be the coordinate of the i-th building. To get from the building i to the building j, Divan spends |xi−xj| minutes, where |y| is the absolute value of y.

All buildings that Divan is going to build can be numbered from 0 to nn. The businessman will live in the building 0, the new headquarters of "Divan's Sofas". In the first ten years after construction Divan will visit the ii-th building aiai times, each time spending 2⋅|x0−xi| minutes for walking.

Divan asks you to choose the coordinates for all n+1 buildings so that over the next ten years the b

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值