//
// main.cpp
// PATA1006
//
// Created by Phoenix on 2018/1/31.
// Copyright © 2018年 Phoenix. All rights reserved.
//
#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
const int maxn = 100010;
struct node{
char id[20];
int in, out;
}stu[maxn];
bool cmp1(node a, node b) {
return a.in < b.in;
}
bool cmp2(node a, node b) {
return a.out > b.out;
}
int main(int argc, const char * argv[]) {
int n;
scanf("%d", &n);
for(int i = 0; i < n; i++) {
int hh, mm, ss;
scanf("%s %d:%d:%d", stu[i].id, &hh, &mm, &ss);
stu[i].in = hh * 3600 + mm * 60 + ss;
scanf("%d:%d:%d", &hh, &mm, &ss);
stu[i].out = hh * 3600 + mm * 60 + ss;
}
sort(stu, stu + n, cmp1);
printf("%s ", stu[0].id);
sort(stu, stu + n, cmp2);
printf("%s", stu[0].id);
return 0;
}
PATA1006题解
最新推荐文章于 2021-09-01 17:17:23 发布