- import java.io.BufferedInputStream;
- import java.util.Date;
- import java.util.Scanner;
- import com.sun.org.apache.regexp.internal.recompile;
- public class Main {
- public static void main(String[] args) {
- Scanner sc = new Scanner(new BufferedInputStream(System.in));
- int days = sc.nextInt();// days of the records
- for (int i = 0; i < days; i++) {
- int details = sc.nextInt();
- String id[] = new String[details];
- String start[] = new String[details];
- String end[] = new String[details];
- String earliest = "23:59:59";
- String lastest = "00:00:00";
- String earliestMan = null;
- String lastestMan = null;
- for (int j = 0; j < details; j++) {
- id[j] = sc.next();
- start[j] = sc.next();
- end[j] = sc.next();
- if (start[j].compareTo(earliest) <= 0) {
- // if the start-time of the worker are earlier than the recoreded-easiest-time
- earliest = start[j];
- earliestMan = id[j];
- }
- if (lastest.compareTo(end[j]) <= 0) {
- // if the end-time of the worker are later
- lastest = end[j];
- lastestMan = id[j];
- }
- }
- System.out.println(earliestMan + " " + lastestMan);
- }
- }
- }
水题了不多说。。