题目链接

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

  1. 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 ...

  2. ACM: Gym 101047K Training with Phuket's larvae - 思维题

     Gym 101047K Training with Phuket's larvae Time Limit:2000MS     Memory Limit:65536KB     64bit IO F ...

  3. ACM: Gym 101047E Escape from Ayutthaya - BFS

    Gym 101047E Escape from Ayutthaya Time Limit:2000MS     Memory Limit:65536KB     64bit IO Format:%I6 ...

  4. ACM: Gym 101047B Renzo and the palindromic decoration - 手速题

     Gym 101047B  Renzo and the palindromic decoration Time Limit:2000MS     Memory Limit:65536KB     64 ...

  5. Gym 101102J---Divisible Numbers(反推技巧题)

    题目链接 http://codeforces.com/gym/101102/problem/J Description standard input/output You are given an a ...

  6. Gym 100917J---Judgement(01背包+bitset)

    题目链接 http://codeforces.com/gym/100917/problem/J Description standard input/outputStatements The jury ...

  7. Gym 100917J---dir -C(RMQ--ST)

    题目链接 http://codeforces.com/gym/100917/problem/D problem description Famous Berland coder and IT mana ...

  8. Gym 101102D---Rectangles(单调栈)

    题目链接 http://codeforces.com/gym/101102/problem/D problem  description Given an R×C grid with each cel ...

  9. Gym 101102C---Bored Judge(区间最大值)

    题目链接 http://codeforces.com/gym/101102/problem/C problem description Judge Bahosain was bored at ACM ...

随机推荐

  1. C++11笔记<一>

    目录: 1.std::share_ptr智能指针: 2.std::tr1::function模板类: 3.stringstream: 4.set/vector/map: 5.static_cast&l ...

  2. 处理 pcap 中的 mac 二进制字节流为可读格式

    import struct # 利用 struct 处理字节流中的mac地址 适用于小端地址操作系统 def mac2str(bi_mac): mac = "" for i in ...

  3. 基于OpenSSL实现C/S架构中的https会话

    在实际生产中实现公司内部的web服务器加密访问时,我们就需要实现公司内部的私钥CA,并且完成对web服务器的签署请求,这样我们就可以在自身的内部机构实现对数据的机密性.完整性.身份验证的访问与传输 实 ...

  4. jprofiler_监控远程linux服务器的tomcat进程(实践)

    一.软件列表: windows和linux的jprofiler的版本必须一致 1.jprofiler_linux_9_1_1.tar.gz 2.jprofiler_windows_x64 9_1_1 ...

  5. Python项目之我的第一个爬虫----爬取豆瓣图书网,统计图书数量

    今天,花了一个晚上的时间边学边做,搞出了我的第一个爬虫.学习Python有两个月了,期间断断续续,但是始终放弃,今天搞了一个小项目,有种丰收的喜悦.废话不说了,直接附上我的全部代码. # -*- co ...

  6. 基于Twitter-Snowflake的java改进版,去状态化实现

    package jeffery; import java.net.InetAddress; import java.net.UnknownHostException; import java.util ...

  7. 5 构建Mysql+heartbeat+DRBD+LVS集群应用系统系列之生产环境下drbd裂脑处理

    preface 公司的业务变更,导致服务器要搬迁,所以需要关闭服务器,然后到新地在开启服务器. 关机前确定drbd+heartbeat+mysql是正常使用的,没有异常,Heartbeat和drbd都 ...

  8. <<< 如何查看自己是外网还是内网

    判断的方法很简单,就是看你的网络中有没有路由器,不管是有线路由还是无线路由,只要你的网络中用了路由,那你就是内网,用路由器的网络有一个特点,那就是只要路由器在开着,那你开了电脑之后就可以直接上网,不需 ...

  9. Node.js入门笔记(2):全局对象(1)

    以下将以API文档为基础进行分析学习 global对象 这些对象在所有模块里都可用.有些对象不是在全局作用域而是在模块作用域里,这些情况下面文档都会标注出来. __filename--返回当前模块文件 ...

  10. [CentOs7]搭建ftp服务器

    摘要 vsftpd 是“very secure FTP daemon”的缩写,安全性是它的一个最大的特点.vsftpd 是一个 UNIX 类操作系统上运行的服务器的名字,它可以运行在诸如 Linux. ...