题107.pat甲级练习-1006 Sign In and Sign Out (25 分)
一、题目
二、题解
输入时转化时间,然后用map作为时间轴标记ID就好
#include <bits/stdc++.h>
using namespace std;
int main()
{
map<int,string> time;
int N;
cin>>N;
for(int i=0;i<N;i++)
{
string ID;
int hh1,mm1,ss1;
int hh2,mm2,ss2;
cin>>ID;
scanf("%d:%d:%d",&hh1,&mm1,&ss1);
scanf("%d:%d:%d",&hh2,&mm2,&ss2);
int time1,time2;
time1=hh1*10000+mm1*100+ss1*1;
time2=hh2*10000+mm2*100+ss2*1;
time[time1]=ID;
time[time2]=ID;
}
cout<<time.begin()->second<<" "<<(--time.end())->second;
}