HDU6759 Leading Robots(杭电多校第一场)

Leading Robots
HDU6759 Leading Robots
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 524288/524288 K (Java/Others)
Total Submission(s): 1811 Accepted Submission(s): 504

Problem Description
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:
在这里插入图片描述
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
The input consists of several test cases. The first line of input consists of an integer T(1≤ T≤50), indicating the number of test cases. The first line of each test case consists of an integer N(0 < N≤ 50000), indicating the number of robots. Each of the following N lines consist of two integers: p,a (0 < p,a < 231) indicating a robot’s position and its acceleration speed.

Output
For each test case, output the number of possible leading robots on a separate line.

Sample Input

1
3
1 1
2 3
3 2

Sample Output

2

题意:给出n个人的初始位置和加速度,运动方向都是向右,求有多少人可以作为leader。当某时刻一个人是唯一一个最领先的人,那么在那个独属的moment, 它就是leader。
在这里插入图片描述

Code:

#include<cmath>
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<queue>
#include<set>
#include<vector>
#include<string>
#include<map>
typedef long long ll;
using namespace std;
const double pi=4*atan(1.0);
const ll mod=1e9+7;
const int inf=0x3f3f3f3f;
using namespace std;
struct node
{
    ll p;
    ll a;
}x[100005];
bool cmp(node a,node b)
{
    if(a.a!=b.a)
        return a.a<b.a;
    else
        return a.p<b.p;
}
int same[100005];
int main()
{
    int T;
    scanf("%d",&T);
    while(T--)
    {
        int n;
        scanf("%d",&n);
        for(int i=0; i<n; i++)
        {
            scanf("%lld %lld",&x[i].p,&x[i].a);
            x[i].p*=-2;
            same[i]=0;
        }
        sort(x,x+n,cmp);
        for(int i=1; i<n; i++)
        {
            if(x[i].p==x[i-1].p&&x[i].a==x[i-1].a)
                same[i]=same[i-1]=1;
        }
        int cnt=0;
        int q[100005];
        q[cnt++]=0;
        memset(q,0,sizeof(q));
        for(int i=1; i<n; i++)
        {
            int pre=q[cnt-1];
            if(x[i].a==x[pre].a)continue;//节约时间
            while(cnt>0&&x[i].p<=x[q[cnt-1]].p)cnt--;//排除斜率为负数的情况
            while(cnt>1)
            {
                int j=q[cnt-1],k=q[cnt-2];
                if((x[i].p-x[j].p)*(x[j].a-x[k].a)<=(x[j].p-x[k].p)*(x[i].a-x[j].a))
                    cnt--;
                else break;
            }
            q[cnt++]=i;
        }
        int ans=0;
        for(int i=0;i<cnt;i++)
        {
            if(!same[q[i]])ans++;
        }
        printf("%d\n",ans);
    }
    return 0;
}

内容概要:该论文深入研究了液压挖掘机动臂下降势能回收技术,旨在解决传统液压挖掘机能耗高的问题。提出了一种新型闭式回路势能回收系统,利用模糊PI自整定控制算法控制永磁无刷直流电动机,实现了变转速容积调速控制,消除了节流和溢流损失。通过建立数学模型和仿真模型,分析了不同负载下的系统性能,并开发了试验平台验证系统的高效性和节能效果。研究还涵盖了执行机构能量分布分析、系统元件参数匹配及电机控制性能优化,为液压挖掘机节能技术提供了理论和实践依据。此外,通过实验验证,该系统相比传统方案可降低28%的能耗,控制系统响应时间缩短40%,为工程机械的绿色化、智能化发展提供了关键技术支撑。 适合人群:从事工程机械设计、制造及维护的工程师和技术人员,以及对液压系统节能技术感兴趣的科研人员。 使用场景及目标:①理解液压挖掘机闭式回路动臂势能回收系统的原理和优势;②掌握模糊PI自整定控制算法的具体实现;③学习如何通过理论建模、仿真和实验验证来评估和优化液压系统的性能。 其他说明:此研究不仅提供了详细的理论分析和数学建模,还给出了具体的仿真代码和实验数据,便于读者在实际工作中进行参考和应用。研究结果表明,该系统不仅能显著提高能源利用效率,还能延长设备使用寿命,降低维护成本,具有重要的工程应用价值。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值