HDU 4557
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 ;
}
HDU 4557的更多相关文章
- HDU 4557 非诚勿扰(Treap找后继)
非诚勿扰 Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others) Total Submi ...
- HDU 4557 Tree(可持久化字典树 + LCA)
http://acm.hdu.edu.cn/showproblem.php?pid=4757 题意: 给出一棵树,每个结点有一个权值,现在有多个询问,每次询问包含x,y,z三个数,求出在x到y的路径上 ...
- hdu 4557 非诚勿扰
水题…… 代码如下: #include<iostream> #include<stdio.h> #include<algorithm> #include<io ...
- hdu 4557 非诚勿扰 vector的应用 原来vector 可以删除指定位置元素 不过消耗大
非诚勿扰 Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others) Total Submi ...
- HDU 4557 非诚勿扰 队列、(记一次失败的SBT尝试)
非诚勿扰 Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others) [Problem De ...
- hdu 4557 暴力
题意: 作为2013年699万应届毕业生中的一员,由于宏观经济的不景气,小明在毕业当天就华丽丽地失业了! 经历了千难万苦的求职过程,小明特别能理解毕业生的就业之难,所以,他现在准备创建一家专门针对IT ...
- HDOJ 2111. Saving HDU 贪心 结构体排序
Saving HDU Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total ...
- 【HDU 3037】Saving Beans Lucas定理模板
http://acm.hdu.edu.cn/showproblem.php?pid=3037 Lucas定理模板. 现在才写,noip滚粗前兆QAQ #include<cstdio> #i ...
- hdu 4859 海岸线 Bestcoder Round 1
http://acm.hdu.edu.cn/showproblem.php?pid=4859 题目大意: 在一个矩形周围都是海,这个矩形中有陆地,深海和浅海.浅海是可以填成陆地的. 求最多有多少条方格 ...
随机推荐
- Windows10中注册 regsvr32 xxx.ocx报错but the call to DIIRegisterServer failed with error code 0x80040200
网站中有读取居民身份证的机器,需要安装一些注册activeX控件然后进入指定目录下执行以下命令regsvr32 xxx.ocx报了个错: but the call to DIIRegisterServ ...
- mtime 的具体解释
find . -mtime +0 # find files modified greater than 24 hours ago find . -mtime 0 # find files modifi ...
- Android程序员眼中世界上最遥远的距离
世界上最遥远的距离,是我在if里你在else里,似乎一直相伴又永远分离: 世界上最痴心的等待,是我当case你是switch,或许永远都选不上自己: 世界上最真情的相依,是你在try我在catch. ...
- 『cs231n』绪论
笔记链接 cs231n系列所有图片笔记均拷贝自网络,链接如上,特此声明,后篇不再重复. 计算机视觉历史 总结出视觉两个重要结论:1.基础的视觉神经识别的是简单的边缘&轮廓2.视觉是分层的 数据 ...
- Leetcode 92
/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode ...
- html5阴影
<!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml"><head> < ...
- 算法笔记_025:字符串的全排列(Java)
目录 1 问题描述 2 解决方案 2.1 递归实现 2.2 字典序排列实现 1 问题描述 输入一个字符串,打印出该字符串的所有排列.例如,输入字符串”abc”,则输出有字符’a’,’b’,’c’所 ...
- css实现椭圆
先实现个简单点的,用css实现一个圆,ok,直接上代码: .circle{ width: 100px; height:100px; background: red; border-radius: 50 ...
- ECC算法整理纪要
初始ECC算法 1.用户A 密钥生成 (1):用随机数发生器产生随机数k∈[1,n-1]: (2):计算椭圆曲线点PA=[k]G,为公钥,k为用户A私钥: 2. 用户B加密算法及流程 设需要发送的消息 ...
- Shiro 学习资料
参考链接:http://jinnianshilongnian.iteye.com/blog/2018398