Leading Robots--杭电多校01--凸包

我这次终于没有陷入以前的假算法了,hhh
但是被cin double卡成TLE也是难顶,以前看见别人代码写快读,我总是不屑一顾,要是想出正确算法还需要快读吸氧吗。
得,以后我也吸

题目描述:

Sandy likes to play with robots. He is going to organize a running competition between his robots. And he is going to give some presents to the winners. Robots are arranged in a line. They have their initial position (distance from the start line) and acceleration speed. These values might be different. When the competition starts, all robots move to the right with speed:

v ( t ) = a ∗ t v(t) = a * t v(t)=at

Here a is acceleration speed and t is time from starting moment.

Now, the problem is that, how many robots can be the leader from the starting moment?

Here leader means the unique rightmost robot from the start line at some moment. That is, at some specific time, if a robot is rightmost and unique then it is the leading robot at that time. There can be robots with same initial position and same acceleration speed.

The runway is so long that you can assume there’s no finish line.

样例

input output
1
3
1 1
2 3
3 2
2

分析

对任意robot i,在时间 t t t时的位置坐标:
f ( i , t ) = p i + a t 2 2 f(i, t) = p_i + \frac{at^2}{2} f(i,t)=pi+2at2
如果要robot i,有机会当第一,则
p i + a i t 2 2 > p j + a j t 2 2 p_i + \frac{a_it^2}{2} > p_j + \frac{a_jt^2}{2} pi+2ait2

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值