solution.cpp 567 字节
Newer Older
每日一练社区's avatar
每日一练社区 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
#include <bits/stdc++.h>
using namespace std;
int main()
{
    string open_time = "99:99:99", close_time, open_id, close_id;
    int n;
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        string id, in_time, out_time;
        cin >> id >> in_time >> out_time;
        if (in_time < open_time)
        {
            open_id = id;
            open_time = in_time;
        }
        if (out_time > close_time)
        {
            close_time = out_time;
            close_id = id;
        }
    }
    cout << open_id << ' ' << close_id << endl;
    return 0;
}