1
typedef pair<string, int> PSI;2
typedef pair<string, string> PSS;4
typedef vector<PSI> VPSI;5
typedef map<PSS, VI> HPSSVI;6
typedef map<int, VPSI> HIVPSI;8
class UndergroundSystem {13
UndergroundSystem() {}15
void checkIn(int id, string stationName, int t) {16
customer[id].push_back(make_pair(stationName, t));19
void checkOut(int id, string stationName, int t) {20
auto it = customer.find(id);21
int idx = it->second.size() - 1;22
schedule[{it->second[idx].first, stationName}].push_back(t - it->second[idx].second);25
double getAverageTime(string startStation, string endStation) {27
int s = schedule[{startStation, endStation}].size();28
auto it = schedule.find({startStation, endStation});29
for (int i = 0; i < s; i++) sum += schedule[{startStation, endStation}][i];35
* Your UndergroundSystem object will be instantiated and called as such:36
* UndergroundSystem* obj = new UndergroundSystem();37
* obj->checkIn(id,stationName,t);38
* obj->checkOut(id,stationName,t);39
* double param_3 = obj->getAverageTime(startStation,endStation);