zoukankan      html  css  js  c++  java
  • Gym

    题目链接

    #include<cstdio>
    #include<cstring>
    #include<algorithm>
    #include<vector>
    #include<map>
    #include<set>
    using namespace std;
    struct person
    {
        int dep;
        char nm[30];
        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==1)
            {
                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*10000+month*100+day;
                tot.insert(p);
                per[make_pair(p.dep,p.id)]=p;
                deper[p.dep].insert(p);
                printf("%s %s
    ",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
    ",tot.empty()?"Vacant":tot.begin()->nm,
                       deper[p.dep].empty()?"Vacant":deper[p.dep].begin()->nm);
            }
        }
        return 0;
    }
  • 相关阅读:
    MySQL 复制
    MySQL 复制
    MySQL 复制
    MySQL 复制
    Setup Factory 读取安装包的配置文件
    [转]VC传递消息sendmessage
    JQuery.getJSON 没反应
    C#使用SendMessage传递字符串
    C# 注册表修改 立即生效 [转]
    c#开源项目[转]
  • 原文地址:https://www.cnblogs.com/Ritchie/p/6209353.html
Copyright © 2011-2022 走看看