#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<queue>
#include<vector>
#include<map>
#include<unordered_map>
#include<string>
using namespace std;
/*
题意:找到一天中第一个登入的人开门,最后登出的人关门
分析:将时间转化为距离0点的长度单位,记录最早的人的信息,和最晚的人信息
*/
struct Node {
string id;
int itime, otime;
}st,ed,temp;
int caltime(int h, int m, int s) {
return h * 3600 + m * 60 + s;
}
int main() {
int n;
st.itime = 0x3fffffff;
ed.otime = -1;
cin >> n;
while (n--) {
string id;
int h, m, s;
cin >> id;
scanf("%d:%d:%d", &h, &m, &s);
int time = caltime(h, m, s);
if (st.itime > time) {
st.itime = time;
st.id = id;
}
scanf("%d:%d:%d", &h, &m, &s);
time = caltime(h, m, s);
if (ed.otime < time) {
ed.otime = time;
ed.id = id;
}
}
cout << st.id << " " << ed.id;
return 0;
}
PATA1006
最新推荐文章于 2021-09-01 17:17:23 发布