题解 | #开门人和关门人#

开门人和关门人

https://www.nowcoder.com/practice/a4b37b53a44d454ab0834e1517983215

#include <iostream>
#include <map>
using namespace std;

int main() {
    int n;
    cin >> n;
    string no, come, leave;
    map<string, string> intime, outtime;
    while(n --){
        cin >> no >> come >> leave;
        intime[come] = no;
        outtime[leave] = no;
    }
    auto iter = intime.begin();
    cout << iter->second << " ";
    iter = outtime.end();
    iter --;
    cout << iter->second << endl;

    return 0;
}

全部评论

相关推荐

点赞 收藏 评论
分享
牛客网
牛客企业服务