http://acm.hdu.edu.cn/showproblem.php?pid=4557

解决一类问题的set用法

#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <set>
#include <map> using namespace std ; char na[][] ; int main()
{
int T ;
scanf("%d",&T) ;
multiset <int> S[] ;
for(int cas= ;cas<=T ;cas++)
{
for(int i= ;i< ;i++)
S[i].clear() ;
int n ;
scanf("%d",&n) ;
printf("Case #%d:\n",cas) ;
int cnt= ;
int num= ;
while(n--)
{
char op[] ;
scanf("%s",op) ;
if(op[]=='A')
{
int x ;
scanf("%s%d",na[num],&x) ;
S[x].insert(num++) ;
printf("%d\n",++cnt) ;
}
else
{
int x ;
scanf("%d",&x) ;
int flag= ;
for(int i=x ;i<= ;i++)
{
if(!S[i].empty())
{
multiset <int>::iterator it ;
it=S[i].lower_bound() ;
if(it!=S[i].end())
{
flag= ;
printf("%s\n",na[*it]) ;
S[i].erase(it) ;
cnt-- ;
break ;
}
}
}
if(!flag)
{
puts("WAIT...") ;
}
}
}
}
return ;
}

最新文章

  1. Linux操作系统启动流程梳理
  2. CREATE TABLE 表名 AS SELECT 语句
  3. Use BEC to do mobile phone forensics
  4. D&amp;F学数据结构系列——AVL树(平衡二叉树)
  5. 代码修改mysql字符
  6. linux下CDROM挂载
  7. WdatePicker日历控件使用方法
  8. 我用Cocos2d-x模拟《Love Live!学院偶像祭》的Live场景(四)
  9. (七十六)CoreLocation(二)获取经纬度、速度、方向,进行区域监听
  10. Java开发笔记(八十六)通过缓冲区读写文件
  11. 【ASP.NET Core快速入门】(十六)MVC开发:DbContextSeed初始化
  12. zabbix问题记录
  13. leetcode --binary tree
  14. springboot系列二、springboot项目搭建
  15. 利用MATLAB截取一张复杂图片中想要的区域
  16. toArray()
  17. 在 Sublime Text 2 下开启 Vim 模式
  18. Python——爬虫学习1
  19. 大数据学习--day08(hnapp 后台系统开发、面向对象)
  20. Java开发环境搭建——IntelliJ Idea开发环境

热门文章

  1. Codeforces Round #289 (Div. 2, ACM ICPC Rules) E. Pretty Song 算贡献+前缀和
  2. Springboot 学习笔记 之 Day 4 笔记部分
  3. 正则表达式提取HTML中img标签的src地址
  4. Qt5_各种路径
  5. 网站链接facebook 拿新的post
  6. English trip -- Phonics 4 元音字母 i
  7. 看起来很懵的java内存加载面试题
  8. The requested URL /phpmyadmin was not found on this server.
  9. 【转】asp.net 下的中文分词检索工具 - jieba.net
  10. httpclient 相关使用介绍