4517 {
4518 unsigned n;
4519 unsigned k;
4520 cin >> n >> k;
4521 unsigned next = 0;
4522 unsigned current = 0;
4523 priority_queue<unsigned, vector<unsigned>, greater<unsigned>> pq;
4524 vector<customer> customers(n);
4525 for(unsigned i = 0; i < n; i++) {
4526 string time;
4527 unsigned p;
4528 cin >> time >> p;
4529 customers[i] =
customer(i, time, min(60U, p) * 60);
4530 }
4531 sort(customers.begin(), customers.end());
4532 for(unsigned i = 0; i < k; i++) {
4533 pq.push(8 * 60 * 60);
4534 }
4535 unsigned total = 0;
4536 unsigned cnt = 0;
4537 for(auto &c: customers) {
4538 unsigned t = pq.top();
4539 pq.pop();
4540 if(c.arrive_time > 17 * 60 * 60) {
4541 break;
4542 }
4543 const unsigned start_time = max(c.arrive_time, t);
4544 total += start_time - c.arrive_time;
4545 cnt++;
4546 pq.push(start_time + c.p);
4547 }
4548 cout << fixed
4549 << setprecision(1) << static_cast<double>(total) / cnt / 60;
4550 return 0;
4551 }