携程第二题 订单+入店离店时间
#include<iostream>
#include<set>
#include<string>
#include<fstream>
#include<vector>
using namespace std;
struct dd {
int id;
string starttime,endtime;
dd(int x, string start, string end) {
id = x;
starttime = start;
endtime = end;
}
bool operator<(const dd&ss) {
return id < ss.id;
}
};
int main(void) {
int all;
cin >> all;
cin.get();
string tt;
vector<dd>storage;
getline(cin,tt); //时间匹配
for (int i = 0;i < all;i++) {
int x;string start, end;
cin >> x >> start >> end;
storage.push_back(dd(x,start,end));
}
set<int>out;
for (int i = 0;i < storage.size();i++) {
if (storage[i].starttime <= tt && tt <= storage[i].endtime)
out.insert(storage[i].id);
}
if (out.empty()) {
cout << "null";
return 0;
}
for (auto it = out.begin();it != out.end();it++)
cout << *it << "\n";
}
#携程#