1006. Sign in and sign out (25) time limit: Ms Memory limit 65536 KB code length limit 16000 B procedure StandardAuthor Chen, Yue
At the beginning of every day, the first person who signs in the computer, the unlock, and the last one who Signs out would lock the door. Given the records of signing in's and out ' s, you're supposed to find the ones who has unlocked and locked the door on th At day.
Input Specification:
Each input file contains the one test case. Each case contains the records for one day. The case starts with a positive integer M, which are the total number of records, followed by M lines, each in the format:
Id_number Sign_in_time Sign_out_time
The Where times is given in the format HH:MM:SS, and the ID number is a string with no more than the characters.
Output Specification:
For each test case, the output in one line of the ID numbers of the persons who has unlocked and locked the door on. The ID numbers must is separated by one space.
Note:it is guaranteed, the records is consistent. That was, the sign in time must was earlier than the sign off time for each person, and there was no, and persons sign in or Out at the same moment.
Sample Input:
3cs301111 15:30:28 17:00:10sc3021234 08:00:00 11:25:25cs301133 21:45:00 21:58:40
Sample Output:
SC3021234 CS301133
1#include <cstdio>2#include <cstring>3#include <string>4#include <queue>5#include <algorithm>6#include <iostream>7 using namespacestd;8 structnode{9 Charid[ -],intime[Ten],outtime[Ten];Ten }; One BOOLCMP1 (node A,node b) { A returnstrcmp (A.intime,b.intime) <0; - } - BOOLCMP2 (node A,node b) { the returnstrcmp (A.outtime,b.outtime) >0; - } - intMain () { - //freopen ("D:\\input.txt", "R", stdin); + intN; -scanf"%d",&n); +Node *p=NewNode[n]; A inti; at for(i=0; i<n;i++){ -scanf"%s %s%s",&p[i].id,&p[i].intime,&p[i].outtime); - } -Sort (p,p+n,cmp1); -cout<<p[0].id<<" "; -Sort (p,p+n,cmp2); incout<<p[0].id<<Endl; - return 0; to}
pat1006. Sign in and sign out (25)