#include<iostream>
#include<stdio.h>
#include<queue>
using namespace std;
struct people {
int needtime;
int sumtime;
friend bool operator<(people a, people b) {
return a.sumtime > b.sumtime;
}
}t;
int main() {
int i, n, k, nowtime = 8 * 60 * 60, wait = 0, bh, j, sp = 0;
cin >> n >> k;
priority_queue<int,vector<int>,greater<int>>endtime(k, 28800);
priority_queue<people>p;
for (i = 1; i <= n; i++) {
int h, m, s, w, temp;
scanf("%d:%d:%d", &h, &m, &s);
scanf("%d", &w);
temp = h * 60 * 60 + m * 60 + s;
if (temp > 17 * 60 * 60)
continue;
t.needtime = w * 60;
t.sumtime = temp;
p.push(t);
}
while (!p.empty()) {
if (p.top().sumtime < endtime.top()) {
wait += endtime.top() - p.top().sumtime;
endtime.push(endtime.top() + p.top().needtime);
endtime.pop();
}
else {
endtime.push(p.top().needtime + p.top().sumtime);
endtime.pop();
}
sp++;
p.pop();
}
printf("%.1lf", 1.0 * wait / (sp * 60.0));
return 0;
}
1017 Queueing at Bank
最新推荐文章于 2024-09-09 23:37:48 发布