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

开门人和关门人

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

#include <bits/stdc++.h>

using namespace std;

typedef struct People{
	string num;
	string open_time;
	string close_time;
	
}People;

vector<People> p;

bool cmp_open(People p1, People p2){
	return p1.open_time < p2.open_time;
}

bool cmp_close(People p1, People p2){
	return p1.close_time > p2.close_time;
}
int main(){
	
	int n;
	cin >> n;
	for (int i=0; i<n; i++){
		string num;
		string open_time;
		string close_time;
		cin >> num >> open_time >> close_time;
		p.push_back({num, open_time, close_time});
	}
	sort(p.begin(), p.end(), cmp_open);
	cout << p[0].num << " ";
	sort(p.begin(), p.end(), cmp_close);
	cout << p[0].num << endl;
	return 0;
}

全部评论

相关推荐

uu们,拒offer时hr很生气怎么办我哭死
爱睡觉的冰箱哥:人家回收你的offer,或者oc后没给你发offer的时候可不会愧疚你,所以你拒了也没必要愧疚他。
点赞 评论 收藏
分享
05-19 19:57
蚌埠学院 Python
2237:Gpa70不算高,建议只写排名,个人技能不在多而在精,缩到8条以内。项目留一个含金量高的,减少间距弄到一页,硕士简历也就一页,本科不要写很多
实习,投递多份简历没人回...
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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