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 <cstring>
#include <string>
#include <queue>
#include <algorithm>
#include <iostream>
using namespace std;
struct node{
char id[],intime[],outtime[];
};
bool cmp1(node a,node b){
return strcmp(a.intime,b.intime)<;
}
bool cmp2(node a,node b){
return strcmp(a.outtime,b.outtime)>;
}
int main(){
//freopen("D:\\INPUT.txt","r",stdin);
int n;
scanf("%d",&n);
node *p=new node[n];
int i;
for(i=;i<n;i++){
scanf("%s %s %s",&p[i].id,&p[i].intime,&p[i].outtime);
}
sort(p,p+n,cmp1);
cout<<p[].id<<" ";
sort(p,p+n,cmp2);
cout<<p[].id<<endl;
return ;
}

pat1006. Sign In and Sign Out (25)的更多相关文章

  1. PAT1006:Sign In and Sign Out

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

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

  3. 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 co ...

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

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

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

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

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

  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. C#中实现UrlEncode和UrlDecode

    有时需要进行url编码.解码,比如从html中捞数据,有可能>.&等字符会被编码成>等. WinForm中默认没有引入System.Web,因此要现在项目中引入依赖 System. ...

  2. SpringMVC+Hibernate 项目开发之二 (STS整合Maven)

    为什么用STS不用Eclipse,主要是Eclipse集成Maven把我整疯了,最后估计原因除在网速上了. 其实用了STS以后发现还真比Eclipse好用点. STS本身集成有Maven的,但是默认的 ...

  3. 细说Mammut大数据系统测试环境Docker迁移之路

    欢迎访问网易云社区,了解更多网易技术产品运营经验. 前言 最近几个月花了比较多精力在项目的测试环境Docker迁移上,从最初的docker"门外汉"到现在组里的同学(大部分测试及少 ...

  4. WeStrom自定义设置修改快捷键

    按照下图操作,不BB: 终极懒人设置:!!!

  5. Linux安装Oracle调整tmpfs以突破1.7G的限制

    调整/dev/shm的大小 ---------------------------------------------------------1.查看大小 df -h /dev/shm [@more@ ...

  6. NFS4 挂载同主机多个目录

    写在前面的话 事情是酱婶儿的,前两天实在是帮他们查日志查的心里交瘁了,而且有些时候下班了,也就不想再接到这样的需求,于是想基于 Nginx 做一个文件下载中心,在这个文件下载中心里面存有各个服务的日志 ...

  7. win10 + Lubuntu 双系统安装

    win10 + Lubuntu 双系统安装 最近重装了系统,索性直接安装win10 + Lubuntu 双系统,便于在物理机下进行 Linux开发. 这里我选择的 Linux 发行版是 Lubuntu ...

  8. SQL Server 数据类型与.Net Framework平台映射

    SQL Server 和 .NET Framework 基于不同的类型系统.  例如,.NET Framework Decimal 结构的最大小数位数为 28,而 SQL Server 的 decim ...

  9. CodeForces - 779D String Game(二分)

    Little Nastya has a hobby, she likes to remove some letters from word, to obtain another word. But i ...

  10. C++_类继承3-动态联编和静态联编

    程序调用函数时,将使用哪个可执行代码块呢?编译器负责回答这个问题. 将源代码中的函数调用解释为特定的函数代码块被称为函数名联编(binding). 在C语言中,这非常简单,因为每个函数名对应一个不同的 ...