You are running a reservation-only restaurant.
You already know how many parties have booked for today, and you need to arrange the required number of tables based on the reservations.
Problem 2: This is a follow-up question.
Now we have a fixed number of tables with various sizes, and we also know the sizes of the parties for each reservation.
How can we optimize the table arrangements to minimize idle time?
这道题讨论的是预约制餐厅的桌位安排问题。第一问通常要求根据当天的预约情况,计算或安排需要准备的桌子数量;第二问进一步给出不同大小的桌子和每个预订的顾客人数,要求通过合理分配桌位来尽量减少空置时间或资源浪费。解题时要关注“桌子容量”和“party size”的匹配关系,常见思路会涉及排序、贪心分配,必要时结合优先队列或双指针来提高安排效率。