1006. Sign In and Sign Out (25)

时间限制
400 ms

内存限制
65536 kB

代码长度限制
16000 B

判题程序
Standard

作者
CHEN, Yue

At the beginning of every day, the first person who signs in the computer room will unlock the door, and the last one who signs out will lock the door. Given the records of signing in's and out's, you are supposed to find the ones who have unlocked and locked the door on that day.

Input Specification:

Each input file contains one test case. Each case contains the records for one day. The case starts with a positive integer M, which is the total number of records, followed by M lines, each in the format:

ID_number Sign_in_time Sign_out_time

where times are given in the format HH:MM:SS, and ID number is a string with no more than 15 characters.

Output Specification:

For each test case, output in one line the ID numbers of the persons who have unlocked and locked the door on that day. The two ID numbers must be separated by one space.

Note: It is guaranteed that the records are consistent. That is, the sign in time must be earlier than the sign out time for each person, and there are no two persons sign in or out at the same moment.

Sample Input:

3
CS301111 15:30:28 17:00:10
SC3021234 08:00:00 11:25:25
CS301133 21:45:00 21:58:40

Sample Output:

SC3021234 CS301133
代码:
#include<cstdio>
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;typedef struct person
{string id;string in;string out;
}person;
int compare1(person a,person b)
{return a.in<b.in;
}
int compare2(person a,person b)
{return a.out>b.out;
}int main()
{person p;vector<person> a;int n;cin>>n;while(n--){cin>>p.id>>p.in>>p.out;a.push_back(p);}sort(a.begin(),a.end(),compare1);cout<<a.begin()->id<<" ";sort(a.begin(),a.end(),compare2);cout<<a.begin()->id<<endl;return 0;
}

Sign In and Sign Out相关推荐

  1. PAT甲级1006 Sign In and Sign Out:[C++题解]字符串处理

    文章目录 题目分析 题目链接 题目分析 读入三个字符串. 需要记录最早开门的人的id和时间,最晚离开的人的id和时间. 本题的简单之处在于 时间的位数都相同,比如 10点和01点.因此这样的时间大小比 ...

  2. 1006. Sign In and Sign Out (25)

    1006. Sign In and Sign Out (25) 问题描述: At the beginning of every day, the first person who signs in t ...

  3. [Java] 1006. Sign In and Sign Out (25)-PAT甲级

    1006. Sign In and Sign Out (25) At the beginning of every day, the first person who signs in the com ...

  4. 【PAT甲】1006 Sign In and Sign Out (25分)循环模拟

    problem 1006 Sign In and Sign Out (25分) At the beginning of every day, the first person who signs in ...

  5. [sign in和sign up哪个是注册?哪个是登入?]

    sign in和sign up的意思: 如果是网站的话sign up是注册,sign in是登录的意思,另外,sign out退出

  6. (翻译)‘Sign Up’ 和‘Sign In’按钮让用户混淆的原因

      你能多快看出"Sign Up(PS:注册)"和"Sign In(PS:登录)"的区别?将它们作为按钮名称同时使用,会让用户点错按钮.出现上述问题并不是用户的 ...

  7. sign python_python实现sign签名

    sign签名是用于提供给外部(第三方)调用的接口,调用方需要提供正确的appkey钥匙才能调用,确保了接口的安全性. 签名参数sign生成方法: 假设有请求参数如下: appkey = "1 ...

  8. 【PAT - 甲级1006】Sign In and Sign Out (25分)(STLmap)

    题干: At the beginning of every day, the first person who signs in the computer room will unlock the d ...

  9. 1006. Sign In and Sign Out (25)-PAT甲级真题

    At the beginning of every day, the first person who signs in the computer room will unlock the door, ...

最新文章

  1. 【AI参赛经验】汉字书法识别比赛经验心得——by:microfat_htu
  2. 2018 CVPR GAN 相关论文调研 (自己分了下类,附地址哦)
  3. 国睿驰120gb固态硬盘测试软件,系统盘首选 国睿驰120GB固态硬盘测试
  4. python中浅拷贝与深拷贝
  5. 史上最详细的XGBoost实战
  6. Java在Linux下创建文件,文件夹,删除,拷贝文件的命令
  7. Java笔记-jdbc传输clob到Oracle数据库
  8. Java学习系列(十六)Java面向对象之基于TCP协议的网络通信
  9. select 中添加option的注意
  10. Jzoj5445【NOIP2017提高A组冲刺11.2】失格
  11. Noteexpress更新文献时总出现重复的文献----有人知道怎么解决吗?请多多指教!
  12. 数字图像处理复习记录(二)邻接、连通和形态学处理
  13. armlinux开发板用户自动登录
  14. 计算机英语名词简释及省略解释
  15. 明星开餐饮店,逃不过凉凉的魔咒?
  16. 【实战总结】根据地图经纬度及范围查询坐标点信息
  17. VS2017 创建安装项目模板
  18. 【人脸识别】LPP人脸特征提取【含GUI Matlab源码 1491期】
  19. BSV 上的 Schnorr 签名
  20. 笔记-项目沟通管理-沟通方法和方式

热门文章

  1. Ensemble learning(集成学习)
  2. 坑爹的去哪儿网订酒店经历
  3. Enterprise Library 2.0 技巧(4):如何用编程的方法来配置Logging Application Block
  4. 监测磁盘文件是否被修改程序
  5. Matlab小波包分解后如何求各频带信号的能量值?
  6. 关于栈的理解(读书笔记)
  7. 常见的几种最优化方法
  8. 6678EVM调试K1_STK_v1.1例程中GE_test的时候报错:DDR3 leveling has failed, STATUS = 0x40000064的解决办法
  9. 图像处理算法打包成dll
  10. 学长毕业日记 :本科毕业论文写成博士论文的神操作20170402