Hdu1234_ Door man and door man "structure sort" "Water problem"

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): 11012 Accepted Submission (s): 5612
Problem Description
Every day the first person to the computer room 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.

Input
The first line of the test input gives the total number of days of the record 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
For each day of the record output 1 lines, that day open and close the person's identification number, the middle of 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 Input
3
1
ME3021112225321 00:00:00 23:59:59
2
EE301218 08:05:35 20:56:35
MA301134 12:35:45 21:40:42
3
CS301111 15:30:28 17:00:10
SC3021234 08:00:00 11:25:25
CS301133 21:45:00 21:58:40

Sample Output
ME3021112225321 ME3021112225321
EE301218 MA301134
SC3021234 CS301133

Source

Computer Postgraduate examination of University of Zhejiang University-2005

#include <stdio.h> #include <string.h> #include <algorithm>using namespace std;struct zhengjian{Char    NUM[20];    int shour;    int Sminute;    int ssencend;    int ehour;    int Eminute; int esencend;}    A[1100];bool Cmp1 (Zhengjian A,zhengjian b) {if (A.shour! = b.shour) return a.shour<b.shour;    else if (A.sminute!=b.sminute) return A.sminute < B.sminute;    else if (a.ssencend!=b.ssencend) return a.ssencend < B.ssencend; return A.num < B.num;}    BOOL Cmp2 (Zhengjian A,zhengjian b) {if (A.ehour! = b.ehour) return a.ehour > B.ehour;    else if (A.eminute!=b.eminute) return a.eminute > B.eminute;    else if (a.esencend!=b.esencend) return a.esencend > B.esencend; return A.num < B.num;}    int main () {int n,m;            while (~SCANF ("%d", &n)) {for (int i = 1; I <= N; i++) {scanf ("%d", &m);            memset (A,0,sizeof (a));          for (int j = 0; J < M; J + +)  {GetChar (); scanf ("%s%d:%d:%d%d:%d:%d",a[j].num,&a[j].shour,&a[j].sminute,&a[j].ssencend,&a[j].ehour,&            A[j].eminute,&a[j].esencend);            } sort (A,A+M,CMP1);            printf ("%s", a[0].num);            Sort (A,A+M,CMP2);        printf ("%s\n", a[0].num); }} return 0;}


Hdu1234_ Door man and door man "structure sort" "Water problem"

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.