Galactic Collegiate Programming Contest Gym - 101572G 模拟

Posted qingyuyyyyy

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Galactic Collegiate Programming Contest Gym - 101572G 模拟相关的知识,希望对你有一定的参考价值。

#include<bits/stdc++.h> 
using namespace std;
int n,m;
struct node
{
    int id;
    int slove;
    int pen;
    bool operator<(const node &b)const
    {
        //如果解决的数量和罚时都一样,就按照序号排序 
        if(slove==b.slove&&pen==b.pen)
            return id<b.id;
        //如果解决的数目不一样,就优先按照数目排序 
        if(slove!=b.slove)
            return slove>b.slove;
        //再按照罚时排序 
        return pen<b.pen;
    }
} a[200000];
set<node>s;
int main()
{
    cin>>n>>m;
    for (int i=1; i<=n; i++)
        a[i].id=i;
    for (int i=1; i<=m; i++)
    {
        int l,r;
        scanf("%d%d",&l,&r);
        //删去,更新 
        s.erase(a[l]);
        //解决数目++ 
        a[l].slove++;
        //罚时增加 
        a[l].pen+=r;
        //如果更新的是第一个队
        if(l==1)
        {
            while (!s.empty()&& (a[1] < ( *(--s.end()) )))
                s.erase(--s.end());
        }
        else
        {
            if(a[l]<a[1])
                s.insert(a[l]);
        }
        cout<<s.size()+1<<endl;
    }
}

 

以上是关于Galactic Collegiate Programming Contest Gym - 101572G 模拟的主要内容,如果未能解决你的问题,请参考以下文章

G. The Galactic Olympics(2016-2017 ACM-ICPC, Egyptian Collegiate Programming Contest (ECPC 16)题解)(代码

ROS2之OpenCV基础代码对比foxy~galactic~humble

ROS2之OpenCV人脸识别foxy~galactic~humble

ACM International Collegiate Programming Contest, Tishreen Collegiate Programming Contest (2018) Syr

ACM International Collegiate Programming Contest, JUST Collegiate Programming Contest (2018)

Ros2-galactic下使用std_msgs::msg::Bool