HDU 4557
2024-10-14 08:58:25
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 ;
}
最新文章
- Linux操作系统启动流程梳理
- CREATE TABLE 表名 AS SELECT 语句
- Use BEC to do mobile phone forensics
- D&;F学数据结构系列——AVL树(平衡二叉树)
- 代码修改mysql字符
- linux下CDROM挂载
- WdatePicker日历控件使用方法
- 我用Cocos2d-x模拟《Love Live!学院偶像祭》的Live场景(四)
- (七十六)CoreLocation(二)获取经纬度、速度、方向,进行区域监听
- Java开发笔记(八十六)通过缓冲区读写文件
- 【ASP.NET Core快速入门】(十六)MVC开发:DbContextSeed初始化
- zabbix问题记录
- leetcode --binary tree
- springboot系列二、springboot项目搭建
- 利用MATLAB截取一张复杂图片中想要的区域
- toArray()
- 在 Sublime Text 2 下开启 Vim 模式
- Python——爬虫学习1
- 大数据学习--day08(hnapp 后台系统开发、面向对象)
- Java开发环境搭建——IntelliJ Idea开发环境
热门文章
- Codeforces Round #289 (Div. 2, ACM ICPC Rules) E. Pretty Song 算贡献+前缀和
- Springboot 学习笔记 之 Day 4 笔记部分
- 正则表达式提取HTML中img标签的src地址
- Qt5_各种路径
- 网站链接facebook 拿新的post
- English trip -- Phonics 4 元音字母 i
- 看起来很懵的java内存加载面试题
- The requested URL /phpmyadmin was not found on this server.
- 【转】asp.net 下的中文分词检索工具 - jieba.net
- httpclient 相关使用介绍