4445 {
4446 map<string, customer> um;
4448 array<unsigned, 24> cost{};
4449 for(int i = 0; i < cost.size(); i++) {
4450 cin >> cost[i];
4451 }
4452 for(
unsigned i = 1; i <
M; i++) {
4453 sum[i] = sum[i - 1] + cost[(i - 1) % 1440 / 60] / 100.0;
4454 }
4455 unsigned int n;
4456 cin >> n;
4457 for(unsigned i = 0; i < n; i++) {
4458 string name;
4459 string time;
4460 string online;
4461 cin >> name >> time >> online;
4462 auto r =
record(name, time, online);
4463 if(!um.contains(name)) {
4465 }
4466 um[name].records.emplace_back(r);
4467 }
4468 for(auto &[name, c]: um) {
4469 sort(c.records.begin(), c.records.end());
4470 for(auto it = c.records.begin(); it != c.records.end();) {
4471 if((*it).online && (it + 1 == c.records.end() || (*(it + 1)).online)) {
4472 it = c.records.erase(it);
4473 } else {
4474 ++it;
4475 }
4476 }
4477 vector<record> new_vec;
4478 bool looking_for_online = true;
4479 for(
const auto &
record: c.records) {
4481 new_vec.emplace_back(
record);
4482 looking_for_online = !looking_for_online;
4483 }
4484 }
4485 c.records = new_vec;
4486 if(!c.records.empty()) {
4487 cout << name <<
' ' << setw(2) << setfill(
'0') <<
right << c.records[0].month << endl;
4488 double total = 0;
4489 for(int i = 0; i < c.records.size(); i += 2) {
4490 const unsigned t2 = c.records[i + 1].get_minutes();
4491 const unsigned t1 = c.records[i].get_minutes();
4492 const double price = sum[t2] - sum[t1];
4493 total += price;
4494 cout << c.records[i].time.substr(3) << ' ' << c.records[i + 1].time.substr(3) << ' ' << t2 - t1 << " $" << fixed << setprecision(2) << price << endl;
4495 }
4496 cout << "Total amount: $" << fixed << setprecision(2) << total << endl;
4497 }
4498 }
4499 return 0;
4500 }