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 ...
随机推荐
- FineUI(专业版)新增 5 款 Metro 皮肤,邀您共赏!
http://fineui.com/demo_pro/ 顺应当前流行趋势,五款Metro皮肤闪亮登场,她们分别是: Metro Blue Metro Dark Blue Metro Gray Metr ...
- 我为什么还要造轮子?欠踹?Monk.UI表单美化插件诞生记!
背景 目前市场上有很多表单美化的UI,做的都挺不错,但是他们都有一个共同点,那就是90%以上都是前端工程师开发的,导致我们引入这些UI的时候,很难和程序绑定.所以作为程序员的我,下了一个决定!我要自己 ...
- SQLite剖析之动态内存分配
SQLite通过动态内存分配来获取各种对象(例如数据库连接和SQL预处理语句)所需内存.建立数据库文件的内存Cache.保存查询结果. 1.特性 SQLite内核和它的内存分配子系统提供以下特性 ...
- Android BLE 蓝牙编程(三)
上节我们已经可以连接上蓝牙设备了. 本节我们就要获取手环的电池电量和计步啦. 在介绍这个之前我们需要先了解下什么是 服务 什么是 UUID 我们记得上节中我们item监听事件的回调的返回值是Bluet ...
- 软件工程(FZU2015)赛季得分榜,第六回合
目录 第一回合 第二回合 第三回合 第四回合 第五回合 第6回合 第7回合 第8回合 第9回合 第10回合 第11回合 积分规则 积分制: 作业为10分制,练习为3分制:alpha30分: 团队项目分 ...
- resin启动报错:guava-15.0.jar!/META-INF/beans.xml:5: <beans xmlns="http://xmlns.jcp.org/xml/ns/javaee"> is an unexpected top-level tag. 异常
项目完成,经过本地的测试,最后在部署的时候,发现服务器resin启动失败,报错信息如下:
- JAVA锁的膨胀过程和优化
首先说一下锁的优化策略. 1,自旋锁 自选锁其实就是在拿锁时发现已经有线程拿了锁,自己如果去拿会阻塞自己,这个时候会选择进行一次忙循环尝试.也就是不停循环看是否能等到上个线程自己释放锁.这个问题是基于 ...
- BZOJ 3236: [Ahoi2013]作业
3236: [Ahoi2013]作业 Time Limit: 100 Sec Memory Limit: 512 MBSubmit: 1393 Solved: 562[Submit][Status ...
- MySQL字符串连接函数
一.CONCAT(str1,str2,…) 返回结果为连接参数产生的字符串.如有任何一个参数为NULL ,则返回值为 NULL. select concat(s_id, "--", ...
- Java框架--jQueryEasyUI
111------------------------------------------------------------------------------------------------- ...