Gym - 100917H
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
using namespace std;
struct person
{
int dep;
char nm[];
int time;
int id;
bool operator <(const person &oth)const
{
if(time!=oth.time)return time<oth.time;
if(dep!=oth.dep)return dep<oth.dep;
return id<oth.id;
}
};
map<int,int>cnt;
map<int,set<person> >deper;
set<person>tot;
map<pair<int,int>,person>per;
person p;
int main()
{
//freopen("cin.txt","r",stdin);
int n;
scanf("%d",&n);
while(n--)
{
int t;
scanf("%d",&t);
if(t==)
{
scanf("%d%s",&p.dep,p.nm);
if(deper.find(p.dep)==deper.end())
{
deper[p.dep]=set<person>();
}
p.id=++cnt[p.dep];
int day,month,year;
scanf("%d:%d:%d",&day,&month,&year);
p.time=year*+month*+day;
tot.insert(p);
per[make_pair(p.dep,p.id)]=p;
deper[p.dep].insert(p);
printf("%s %s\n",tot.begin()->nm,deper[p.dep].begin()->nm);
}
else
{
int d,k;
scanf("%d%d",&d,&k);
p=per[make_pair(d,k)];
tot.erase(p);
deper[d].erase(p);
printf("%s %s\n",tot.empty()?"Vacant":tot.begin()->nm,
deper[p.dep].empty()?"Vacant":deper[p.dep].begin()->nm);
}
}
return ;
}
Gym - 100917H的更多相关文章
- ACM: Gym 101047M Removing coins in Kem Kadrãn - 暴力
Gym 101047M Removing coins in Kem Kadrãn Time Limit:2000MS Memory Limit:65536KB 64bit IO Fo ...
- ACM: Gym 101047K Training with Phuket's larvae - 思维题
Gym 101047K Training with Phuket's larvae Time Limit:2000MS Memory Limit:65536KB 64bit IO F ...
- ACM: Gym 101047E Escape from Ayutthaya - BFS
Gym 101047E Escape from Ayutthaya Time Limit:2000MS Memory Limit:65536KB 64bit IO Format:%I6 ...
- ACM: Gym 101047B Renzo and the palindromic decoration - 手速题
Gym 101047B Renzo and the palindromic decoration Time Limit:2000MS Memory Limit:65536KB 64 ...
- Gym 101102J---Divisible Numbers(反推技巧题)
题目链接 http://codeforces.com/gym/101102/problem/J Description standard input/output You are given an a ...
- Gym 100917J---Judgement(01背包+bitset)
题目链接 http://codeforces.com/gym/100917/problem/J Description standard input/outputStatements The jury ...
- Gym 100917J---dir -C(RMQ--ST)
题目链接 http://codeforces.com/gym/100917/problem/D problem description Famous Berland coder and IT mana ...
- Gym 101102D---Rectangles(单调栈)
题目链接 http://codeforces.com/gym/101102/problem/D problem description Given an R×C grid with each cel ...
- Gym 101102C---Bored Judge(区间最大值)
题目链接 http://codeforces.com/gym/101102/problem/C problem description Judge Bahosain was bored at ACM ...
随机推荐
- MarkdownPad2 Pro v2.4.2.29969 专业中文破解版完美支持table表格语法
在网上搞了半天,终于搞定了支持table简写语法的markdown软件. 下载地址:http://download.csdn.net/detail/wang_jun_hua/8180717 下载包内含 ...
- 关于 MonoDevelop on Linux 单步调试问题的解决
在 MonoDevelop 中默认是关闭对外部程序集(.dll)的调试,可通过如下步骤来解决这个问题. 通过菜单[Edit]-[Preferences]-[Debugger]进入到调试器的设置页,把“ ...
- 读书笔记---《火球:UML大战需求分析》
书评 作为一本UML和需求分析的入门书来说还算可以,写的比较接地气,如果是做过很多项目的读者,很容易找到共鸣点. 美中不足:部分概念可能有错误,其中对于Component和Artifact的解释明显和 ...
- C#线程池使用
bool stop; private void button3_Click(object sender, EventArgs e) { if(button3.Text=="线程池" ...
- 什么是Jedis?
Jedis 是 Redis 官方首选的 Java 客户端开发包. 实例方法: 1 import redis.clients.jedis.* 1 2 3 Jedis jedis = new Jedis( ...
- HTML5属性--(capture="camera") 上传照片或者打开手机相机
要获取手机相机拍照或者访问相册 这里贴一个相关链接:http://blog.csdn.net/jackfrued/article/details/8967667 JSP页面代码: <inp ...
- OpenLayers的定制
最近因为工作的需要,把主流的的一些GIS的javascript库看了一遍,主要是ArcGIS Server API for Javascript,Openlayers和Leaflet. 先说说ArcG ...
- 源码升级安装python
1.下载 python: https://www.python.org/downloads/release/python-2712/ 2.编译安装 sudo mkdir /usr/local/pyth ...
- SQL Injection bypass WAF
tips: 利用的注射点: 支持Union 可报错 支持多行执行.可执行系统命令.可HTTP Request等额外有利条件 若非以上类型,则可能需要暴力猜解.猜解时,可能会遇到一些限制.攻击者要做的, ...
- Linux 内核数据结构:双向链表
Linux 内核提供一套双向链表的实现,你可以在 include/linux/list.h 中找到.我们以双向链表着手开始介绍 Linux 内核中的数据结构 ,因为这个是在 Linux 内核中使用最为 ...