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

开门人和关门人

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

题目只能简单考虑,测试用例中有得签离时间小于签到时间,按理说上应该是跨了一天的,但本题不能考虑这种情况

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

int main() {
    int n;
    while (cin >> n) { // 注意 while 处理多个 case
        // cout << a + b << endl;
        map<string, string> inMap;
        map<string, string> outMap;
        while (n--) {
            string name;
            string inTime;
            string outTime;
            cin >> name >> inTime >> outTime;
           
            inMap[inTime] = name;
            outMap[outTime] = name;
        }
        cout << inMap.begin()->second << ' ';
        auto it = outMap.end();
        it--;
        cout << it->second << endl;
    }
}
// 64 位输出请用 printf("%lld")

全部评论

相关推荐

挥毫自在:想白嫖你呢
点赞 评论 收藏
分享
09-22 15:45
门头沟学院 Java
谁给娃offer我给...:我也遇到了,我说只要我通过面试我就去,实际上我根本就不会去😁
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务