AtCoder Regular Contest 076 F - Exhausted? 贪心

本文介绍了AtCoder Regular Contest 076 F题目的详细情况,该问题涉及安排背痛的人坐在特定坐标范围内的椅子上。通过贪心策略,找到提供额外椅子的最小数量,以确保所有人都能坐下。文章提供了样例输入和输出,以及解题思路,重点在于如何使用贪心方法优化座位分配。
摘要由CSDN通过智能技术生成

F - Exhausted?


Time limit : 2sec / Memory limit : 256MB

Score : 1000 points

Problem Statement

There are M chairs arranged in a line. The coordinate of the i-th chair (1iM) is i.

N people of the Takahashi clan played too much games, and they are all suffering from backaches. They need to sit in chairs and rest, but they are particular about which chairs they sit in. Specifically, the i-th person wishes to sit in a chair whose coordinate is not greater than Li, or not less than Ri. Naturally, only one person can sit in the same chair.

It may not be possible for all of them to sit in their favorite chairs, if nothing is done. Aoki, who cares for the health of the people of the Takahashi clan, decides to provide additional chairs so that all of them can sit in chairs at their favorite positions.

Additional chai

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值