1006 Sign In and Sign Out (25 分)

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

分析:水题,一次过。。

 /**
 * Copyright(c)
 * All rights reserved.
 * Author : Mered1th
 * Date : 2019-02-23-23.17.26
 * Description : A1006
 */
 #include<cstdio>
 #include<cstring>
 #include<iostream>
 #include<cmath>
 #include<algorithm>
 #include<string>
 #include<unordered_set>
 #include<map>
 #include<vector>
 #include<set>
 using namespace std;
 ;
 struct node{
     string id;
     int st;
     int ed;
 }no[maxn];
 bool cmp1(node a,node b){
     return a.st<b.st;
 }
 bool cmp2(node a,node b){
     return a.ed>b.ed;
 }
 int main(){
 #ifdef ONLINE_JUDGE
 #else
     freopen("1.txt", "r", stdin);
 #endif
     int n,h,m,s;
     scanf("%d",&n);
     ;i<n;i++){
         cin>>no[i].id;
         scanf("%d:%d:%d ",&h,&m,&s);
         no[i].st=h*+m*+s*;
         scanf("%d:%d:%d",&h,&m,&s);
         no[i].ed=h*+m*+s*;
     }
     sort(no,no+n,cmp1);
     cout<<no[].id<<" ";
     sort(no,no+n,cmp2);
     cout<<no[].id<<endl;
     ;
 }
 

1006 Sign In and Sign Out (25 分)的更多相关文章

  1. PAT 甲级 1006 Sign In and Sign Out (25)(25 分)

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

  2. 1006 Sign In and Sign Out (25)(25 分)思路:普通的时间比较题。。。

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

  3. pat 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 the com ...

  4. PAT (Advanced Level) Practice 1006 Sign In and Sign Out (25 分) 凌宸1642

    PAT (Advanced Level) Practice 1006 Sign In and Sign Out (25 分) 凌宸1642 题目描述: At the beginning of ever ...

  5. PAT甲 1006. Sign In and Sign Out (25) 2016-09-09 22:55 43人阅读 评论(0) 收藏

    1006. Sign In and Sign Out (25) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue ...

  6. pat1006. Sign In and Sign Out (25)

    1006. Sign In and Sign Out (25) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue ...

  7. PTA (Advanced Level) 1006 Sign In and Sign Out

    Sign In and Sign Out At the beginning of every day, the first person who signs in the computer room ...

  8. PAT甲级——1006 Sign In and Sign Out

    PATA1006 Sign In and Sign Out At the beginning of every day, the first person who signs in the compu ...

  9. PAT Sign In and Sign Out[非常简单]

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

随机推荐

  1. if...then

    我到现在明白一些道理 有些事情是徒劳无功的 有些却不是 世间事不过如此,只要你肯付出相应的代价,你就可以得到.

  2. jQuery单选组美化特效

    需求:根据数据动态生成单选组 代码: <!DOCTYPE html> <html> <head> <meta charset="UTF-8" ...

  3. IOS UIImage两种初始化的区别

    UIImage可以通过以下两种方式进行初始化: 1 //第一种初始化方式:[注意使用这种初始化的时候如果是png格式的可以不给后缀名,根据屏幕的的分辨率去匹配图片] 2 3 UIImage *imag ...

  4. https页面证书验证、加密过程简介

    1.服务器向CA机构获取证书(假设这个证书伪造不了),当浏览器首次请求服务器的时候,服务器返回证书给浏览器.(证书包含:公钥+申请者与颁发者的相关信息+签名) 2.浏览器得到证书后,开始验证证书的相关 ...

  5. pycharm中tensorflow代码不能自动补全或import红线问题解决

    正确安装并配置好pycharm+tensorflow环境之后,可能在pycharm中导入tensorflow会有以下问题: 1. " import tensorflow as tf &quo ...

  6. 【opencv基础】Rect类的神奇用法

    前言 最近看github上源码发现对两个cv::Rect使用相与(&)操作,猛地感觉自己蒙啦,Rect类还有这种神奇用法?!翻看opencv官网Rect类,果然如此! opencv中Rect类 ...

  7. ubuntu16.04 中文输入法

    https://blog.csdn.net/qq_21792169/article/details/53152700 在主文件夹目录即home目录,按快捷键Ctrl+H(显示隐藏文件),看到的.bas ...

  8. 虚拟机lamp环境下,Apache配置虚拟主机

    1.在Apache配置文件中开启虚拟主机功能:即:Include etc//extra/httpd-vhosts.conf把前面的#去掉: 2.在extra目录下找到文件httpd-vhosts.co ...

  9. android 自动拨打电话 挂断电话代码

    页面布局文件代码  (  res下面的layout下面的activity_main.xml代码 ) <RelativeLayout xmlns:android="http://sche ...

  10. setsebool命令详解与SELinux管理

    setsebool命令是用来修改SElinux策略内各项规则的布尔值.setsebool命令和getsebool命令是SELinux修改和查询布尔值的一套工具组.SELinux的策略与规则管理相关命令 ...