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

开门人和关门人

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")

全部评论

相关推荐

缒梦&独舞:这家公司是这样的,去年给我实习offer了,不过也是面着玩儿的,他周六还要去做公益志愿活动
点赞 评论 收藏
分享
牛客84809583...:举报了
点赞 评论 收藏
分享
不愿透露姓名的神秘牛友
07-10 12:05
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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