Door opener and closing man

Source: Internet
Author: User

Door opener and closing man
Time limit:2000/1000 MS (java/others) Memory limit:65536/32768 K (java/others)
Total submission (s): 3451 Accepted Submission (s): 1646
Problem description The first person to the computer room every day to open the door, the last one to leave the door closed. There are a lot of cluttered room to sign, check out records, please according to the records to find the day open and close the door.  
The first line of input test inputs gives the total number of days of records N (> 0). The following is a list of N-Day records. Each day the record in the first row gives the number of entries in the record m (> 0), the following is the M row, each line is formatted as
Passport number check-in time sign-off time
The time is given by "hours: minutes: Seconds" (2 bits each), and the ID number is a string of no more than 15 length.
Output 1 lines for each day's record, that is, the opening and closing of the person's identification number, in the middle with 1 spaces separated. Note: In the referee's standard test input, all records are guaranteed to be complete, and each person's check-in time is before the time of checkout, and there are not many people who sign in or sign out at once.  
Sample Input
31me3021112225321 00:00:00 23:59:592ee301218 08:05:35 20:56:35ma301134 12:35:45 21:40:423cs301111 15:30:28 17:00:10sc3021234 08:00:00 11:25:25cs301133 21:45:00 21:58:40
Sample Output
ME3021112225321 me3021112225321ee301218 ma301134sc3021234 CS301133

Direct sort, the water

# include <iostream># include<cstdio># include<string># include<algorithm># include<vector>using namespacestd;structpeople{stringname; stringJin; stringChu;};BOOLCmp1 (People A, people b) {returnA.jin <B.jin;}BOOLCMP2 (People A, people b) {returnA.chu >B.chu;}intMain () {intT; CIN>>T;  while(t--) {vector<People>v;        People p; intN; CIN>>N;  for(inti =0; I < n; i++) {cin>> p.name >> P.jin >>P.chu;        V.push_back (P);            } sort (V.begin (), V.end (), CMP1); cout<< v[0].name <<" ";            Sort (V.begin (), V.end (), CMP2); cout<< v[0].name <<Endl; }    return 0;}

Door opener and closing man

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.