4446 map<string, customer> um;
4448 array<unsigned, 24> cost{};
4449 for(
int i = 0; i < cost.size(); i++) {
4452 for(
unsigned i = 1; i <
M; i++) {
4453 sum[i] = sum[i - 1] + cost[(i - 1) % 1440 / 60] / 100.0;
4457 for(
unsigned i = 0; i < n; i++) {
4461 cin >> name >> time >> online;
4462 auto r = record(name, time, online);
4463 if(!um.contains(name)) {
4464 um[name] = customer(name);
4466 um[name].records.emplace_back(r);
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);
4477 vector<record> new_vec;
4478 bool looking_for_online =
true;
4479 for(
const auto &record: c.records) {
4480 if(looking_for_online == record.online) {
4481 new_vec.emplace_back(record);
4482 looking_for_online = !looking_for_online;
4485 c.records = new_vec;
4486 if(!c.records.empty()) {
4487 cout << name <<
' ' << setw(2) << setfill(
'0') <<
right << c.records[0].month << endl;
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];
4494 cout << c.records[i].time.substr(3) <<
' ' << c.records[i + 1].time.substr(3) <<
' ' << t2 - t1 <<
" $" << fixed << setprecision(2) << price << endl;
4496 cout <<
"Total amount: $" << fixed << setprecision(2) << total << endl;