题意: 找到最早进门的人和最晚出门的人.字符串比较即可.
模拟:
1 #include<iostream> 2 #include<vector> 3 #include<queue> 4 #include<map> 5 #include<set> 6 #include<cmath> 7 #include<cstdio> 8 #include<cstdlib> 9 #include<cstring> 10 #include<algorithm> 11 using namespace std; 12 13 int main() 14 { 15 int N; 16 cin >> N; 17 string id, inT, outT; 18 string start = "24:00:00", end = "00:00:00"; 19 string startId, endId; 20 for (int i = 0; i < N; i++) { 21 cin >> id >> inT >> outT; 22 if (inT <= start) { 23 start = inT; 24 startId = id; 25 } 26 if (outT >= end) { 27 end = outT; 28 endId = id; 29 } 30 } 31 cout << startId << " " << endId << endl; 32 return 0; 33 }