欢迎来到起遇信息学
起遇信息学正处于上线筹建阶段,以下功能已全部开放免费体验: ✅ 完整题库浏览与代码提交评测(C / C++ / Python / Java 等) ✅ 入门到进阶的系列课程试读、作业与考试 ✅ AI 提示、AI 作业分析等智能助教功能 ✅ 赛事模拟与个人能力报告 ✅ 邮箱注册开放 ⏳ 付费课程订阅与微信/支付宝支付通道 ⏳ 手机号登录,微信扫码登录、微信公众号绑定 使用中如遇任何问题,欢迎通过页面底部 **"联系我们"** 与我们沟通。
CF1140C.Playlist
Playlist
CF1140C · Playlist
- 难度:1600
- 标签:brute force、data structures、sortings
- 链接:https://codeforces.com/problemset/problem/1140/C
- 时间限制:2 seconds 内存限制:256 megabytes
- 出现位置:Day04-反悔贪心-优先队列-排序贡献
英文原题面
Statement
You have a playlist consisting of songs. The -th song is characterized by two numbers and — its length and beauty respectively. The pleasure of listening to set of songs is equal to the total length of the songs in the set multiplied by the minimum beauty among them. For example, the pleasure of listening to a set of songs having lengths and beauty values is equal to . You need to choose at most songs from your playlist, so the pleasure of listening to the set of these songs them is maximum possible.
Input
The first line contains two integers and () – the number of songs in the playlist and the maximum number of songs you can choose, respectively. Each of the next lines contains two integers and () — the length and beauty of -th song.
Output
Print one integer — the maximum pleasure you can get.
样例
样例 1
输入:
4 3
4 7
15 1
3 6
6 8
输出:
78
样例 2
输入:
5 3
12 31
112 4
100 100
13 55
55 50
输出:
10000
样例解释(英文原文)
In the first test case we can choose songs , so the total pleasure is . In the second test case we can choose song . The total pleasure will be equal to .
在线编程 IDE
建议全屏模式获得最佳体验
| 进入全屏编程 | Alt+E |
| 递交评测 | Ctrl+Enter |
| 注释/取消注释 | Ctrl+/ |
| 缩放字体 | Ctrl+滚轮 |