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的更多相关文章

  1. HDU 4557 非诚勿扰(Treap找后继)

    非诚勿扰 Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 65535/32768 K (Java/Others) Total Submi ...

  2. HDU 4557 Tree(可持久化字典树 + LCA)

    http://acm.hdu.edu.cn/showproblem.php?pid=4757 题意: 给出一棵树,每个结点有一个权值,现在有多个询问,每次询问包含x,y,z三个数,求出在x到y的路径上 ...

  3. hdu 4557 非诚勿扰

    水题…… 代码如下: #include<iostream> #include<stdio.h> #include<algorithm> #include<io ...

  4. hdu 4557 非诚勿扰 vector的应用 原来vector 可以删除指定位置元素 不过消耗大

    非诚勿扰 Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 65535/32768 K (Java/Others) Total Submi ...

  5. HDU 4557 非诚勿扰 队列、(记一次失败的SBT尝试)

    非诚勿扰 Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 65535/32768 K (Java/Others) [Problem De ...

  6. hdu 4557 暴力

    题意: 作为2013年699万应届毕业生中的一员,由于宏观经济的不景气,小明在毕业当天就华丽丽地失业了! 经历了千难万苦的求职过程,小明特别能理解毕业生的就业之难,所以,他现在准备创建一家专门针对IT ...

  7. HDOJ 2111. Saving HDU 贪心 结构体排序

    Saving HDU Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total ...

  8. 【HDU 3037】Saving Beans Lucas定理模板

    http://acm.hdu.edu.cn/showproblem.php?pid=3037 Lucas定理模板. 现在才写,noip滚粗前兆QAQ #include<cstdio> #i ...

  9. hdu 4859 海岸线 Bestcoder Round 1

    http://acm.hdu.edu.cn/showproblem.php?pid=4859 题目大意: 在一个矩形周围都是海,这个矩形中有陆地,深海和浅海.浅海是可以填成陆地的. 求最多有多少条方格 ...

随机推荐

  1. flask报错No module named 'flask.ext'

    解决: from flask.ext.httpauth import HTTPBasicAuth 改为 from flask_httpauth import HTTPBasicAuth 提示Modul ...

  2. python 线性查找

    import random val= data=[,,,,] : find= val=int(input('请输入查找键值(1-9),输入-1离开:')) for i in data: if i==v ...

  3. Codeforces 855B - Marvolo Gaunt's Ring

    855B - Marvolo Gaunt's Ring 思路:①枚举a[j],a[i]和a[k]分别用前缀最小值最大值和后缀最小值和后缀最大值确定. ②dp,dp[i][j]表示到第j为止,前i+1个 ...

  4. Python 爬虫-图片的爬取

    2017-07-25 22:49:21 import requests import os url = 'https://wallpapers.wallhaven.cc/wallpapers/full ...

  5. [Java学习] Java多态和动态绑定

    在Java中,父类的变量可以引用父类的实例,也可以引用子类的实例. 请读者先看一段代码: 1. public class Demo { 2. public static void main(Strin ...

  6. C++&C#外挂(内存修改)

    大学时候因为主修C#语言(当然现在做的是javaweb开发),那时在网上学了用C#做外挂的教程,外挂嘛,大家都懂的.这里只是低级的修改内存,不涉及到截获数据包.如果是欺骗服务器,修改服务器数据,那就难 ...

  7. CentOS 7 install Nginx

    1. rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.r ...

  8. 贪心(二)NYOJ14题

    #include <iostream> #include<cmath> #include "algorithm" using namespace std; ...

  9. Vue--- 手动禁止ESlint

    使用vue-cli构建项目时,通常会问你要不要 “Use ESlint to lint your code?” 建议使用,这样会有助于规范我们的代码(这也是一种审美),ESlint的规范就不说了,写多 ...

  10. Python简单网页爬虫——极客学院视频自动下载

    http://blog.csdn.net/supercooly/article/details/51003921