set默认进行升序排列,通过结构体可以改。

维护一个比主人公分数高的set 降序排列,比主人公高就进入set 比主人公低就不进去,或者在删除操作里删掉。

然后血的教训

https://blog.csdn.net/yangruibao/article/details/9040045

#include <bits/stdc++.h>
using namespace std;
const int maxn=1e5+7;
struct node{
int t,val;
bool operator<(const node&c)const{
if(c.val==val){
return t<c.t;
}
else{
return val>c.val;
}
}
}s[maxn];
multiset<node>mot;
int main(){
int n,m;while(~scanf("%d%d",&n,&m)){
for(int i=0;i<=n;i++){
s[i].val=s[i].t=0;
}
for(int i=1;i<=m;++i){
int o,p;scanf("%d%d",&o,&p);
if(o==1){
s[1].t+=p;
s[1].val++;
}
else{
if(s[o]<s[1]){
mot.erase(mot.find(s[o]));
}
s[o].val++;
s[o].t+=p;
mot.insert(s[o]);
}
while (!mot.empty()&&!(*--mot.end()<s[1])){
mot.erase(--mot.end());
}
printf("%d\n",(int)mot.size()+1);
}
}
}

最新文章

  1. test markdown
  2. Retrofit学习入门
  3. A configuration with this name already exists
  4. Intelli IDEA 14.04开发版+注册码
  5. Codeforces Round #372 (Div. 2) A
  6. echarts在360中以及IE8浏览器不兼容:解决方案
  7. linux中的文件类型
  8. JSON2 源代码
  9. classes system in sencha touch
  10. 标准I/O库之格式化I/O
  11. window 7 C盘整理
  12. nginx 配置访问正则匹配
  13. poj 1018 Communication System_贪心
  14. Extjs入门-grid
  15. Spring BeanWrapper分析
  16. 【转载】C++引用详解
  17. CountDownLatch使用场景及分析
  18. javascript的初步认识
  19. 十分钟搞懂快速傅里叶变换(FFT)
  20. cesium编程入门(六)添加 3D Tiles,并调整位置,贴地

热门文章

  1. LIS是什么?【标本分拣】
  2. HashMap核心功能源码浅析
  3. SpringCloud学习之Ribbon使用(四)
  4. Python笔记_第五篇_Python数据分析基础教程_相关安装和版本查看
  5. winform显示、隐藏任务栏及开始菜单
  6. PAT Advanced 1004 Counting Leaves (30) [BFS,DFS,树的层序遍历]
  7. Swagger注解及参数细节的正确书写。
  8. 并发与高并发(八)-线程安全性-原子性-synchronized
  9. Python笔记_第四篇_高阶编程_高阶函数_3.sorted
  10. 移植sqlite