AcWing 1478. 签到与签出
原题链接
简单
作者:
一抹斜阳
,
2020-12-22 19:53:59
,
所有人可见
,
阅读 372
#include <iostream>
#include <string>
using namespace std;
int m;
string str[10][3];
int first, last;
int allSecond(string time){
int h = (time[0] - '0') * 10 + time[1] - '0';
int m = (time[3] - '0') * 10 + time[4] - '0';
int s = (time[6] - '0') * 10 + time[7] - '0';
return h * 3600 + m * 60 + s;
}
int main(){
int first = 0; last = 0;
int min = 0x3f3f3f3f;
int max = 0;
cin>>m;
for(int i = 0;i < m;i++){
cin>>str[i][0]>>str[i][1]>>str[i][2];
if(allSecond(str[i][1]) < min){
min = allSecond(str[i][1]);
first = i;
}
if(allSecond(str[i][2]) > max){
max = allSecond(str[i][2]);
last = i;
}
}
cout<<str[first][0]<<" "<<str[last][0]<<endl;
return 0;
}