HDOJ 1234 Door man 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)

#include <stdio.h> #include <string.h> #include <algorithm> #define Max 1000+10using namespace std; struct record      {    char name[20];    Char come[10];    Char go[10];} Num[max];bool CMP (record A,record b) {    return strcmp (a.come,b.come) <0;    Sign in sort}bool cmp1 (record A,record b) {    return strcmp (a.go,b.go) >0;     Check fallback sort}int main () {    int t,n,i,j;    scanf ("%d", &t);    while (t--)    {        scanf ("%d", &n);        for (i=0;i<n;i++)        scanf ("%s%s%s", num[i].name,num[i].come,num[i].go);        Sort (num,num+n,cmp);        printf ("%s", num[0].name);        Sort (NUM,NUM+N,CMP1);        printf ("%s\n", num[0].name);    }    return 0;}

  


Total submission (s): 11667 Accepted Submission (s): 5934


Problem description The first person to the computer room every day to open the door, the last one to leave the door closed. A mess of the existing room
To and from the record, please find out the person who opened and closed the door according to the records.

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 checkout time.
And no more people sign in or sign out at the same time.

Sample input31me3021112225321 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 OutputME3021112225321 me3021112225321ee301218 ma301134sc3021234 CS301133 Typical structural problems

HDOJ 1234 Door man 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.