Educational Codeforces Round 62 (Rated for Div. 2)C
题目链接 :C. Playlist
#include<bits/stdc++.h>
using namespace std;
#define maxn 300005
#define LL long long
#define pii pair<int,int>
const int inf = (int)1e9;
vector<pii>q;
bool cmp(pii a,pii b){
if(a.second==b.second) return a.first>b.first;
return a.second>b.second;
}
priority_queue<LL,vector<LL>,greater<LL> >Q;
int main(){
int n,m;
scanf("%d%d",&n,&m);
;j<n;j++){
int x,y;
scanf("%d%d",&x,&y);
q.push_back(make_pair(x,y));
}
sort(q.begin(),q.end(),cmp);
LL mi =inf,ans = ,mx = ;
;j<n;j++){
if(Q.size()==m){
ans -= Q.top();
Q.pop();
}
ans += q[j].first;
Q.push(q[j].first);
mx = max(mx,1LL*ans*q[j].second);
}
printf("%lld\n",mx);
;
}
Educational Codeforces Round 62 (Rated for Div. 2)C的更多相关文章
- Educational Codeforces Round 62 (Rated for Div. 2) Solution
最近省队前联考被杭二成七南外什么的吊锤得布星,拿一场Div. 2恢复信心 然后Div.2 Rk3.Div. 1+Div. 2 Rk9,rating大涨200引起舒适 现在的Div. 2都怎么了,最难题 ...
- Educational Codeforces Round 62 (Rated for Div. 2)
A. Detective Book 题意:一个人读书 给出每一章埋的坑在第几页可以填完 . 一个人一天如果不填完坑他就会一直看 问几天能把这本书看完 思路:模拟一下 取一下过程中最大的坑的页数 如 ...
- Educational Codeforces Round 62 (Rated for Div. 2) C 贪心 + 优先队列 + 反向处理
https://codeforces.com/contest/1140/problem/C 题意 每首歌有\(t_i\)和\(b_i\)两个值,最多挑选m首歌,使得sum(\(t_i\))*min(\ ...
- Educational Codeforces Round 62 (Rated for Div. 2) - C Playlist
当时题意看错了...不过大致思路是对的,唯一没有想到的就是用优先队列搞这个东西,真是不该啊... 题意大概就是,有N首歌,N首歌有两个东西,一个是长度Ti,一个是美丽值Bi,你最多可以选择K首歌, 这 ...
- C. Playlist Educational Codeforces Round 62 (Rated for Div. 2) 贪心+优先队列
C. Playlist time limit per test 2 seconds memory limit per test 256 megabytes input standard input o ...
- Educational Codeforces Round 62 (Rated for Div. 2)E(染色DP,构造,思维,组合数学)
#include<bits/stdc++.h>using namespace std;const long long mod=998244353;long long f[200007][2 ...
- Educational Codeforces Round 60 (Rated for Div. 2) - C. Magic Ship
Problem Educational Codeforces Round 60 (Rated for Div. 2) - C. Magic Ship Time Limit: 2000 mSec P ...
- Educational Codeforces Round 60 (Rated for Div. 2) - D. Magic Gems(动态规划+矩阵快速幂)
Problem Educational Codeforces Round 60 (Rated for Div. 2) - D. Magic Gems Time Limit: 3000 mSec P ...
- Educational Codeforces Round 43 (Rated for Div. 2)
Educational Codeforces Round 43 (Rated for Div. 2) https://codeforces.com/contest/976 A #include< ...
随机推荐
- jQuery(八)、ajax
1.jQuery.ajax(url[, settings]) 通过HTTP请求加载远程数据. 注意:所有的settings选择都可以通过$.ajaxSetup()函数来全局指定. 回调函数 在实际开发 ...
- JVM虚拟机基本概念
一.JVM运行时数据区域1.1.程序计数器 一块较小的内存空间,当前线程所执行的字节码指示器.每个线程有一个独立的程序计数器1.2.Java虚拟机栈 线程私有,生命周期与线程相同 每个方法在执行时会创 ...
- 【设计模式】建造者模式 Builder Pattern
前面学习了简单工厂模式,工厂方法模式以及抽象工厂模式,这些都是创建类的对象所使用的一些常用的方法和套路, 那么如果我们创建一个很复杂的对象可上面的三种方法都不太适合,那么“专业的事交给专业人去做”,2 ...
- 高通MSM8998 ABL的调试
高通在MSM8998上引入了UEFI,用来代替LK(Little Kernel).高通UEFI由XBL和ABL两部分组成.XBL负责芯片驱动及充电等核心应用功能.ABL包括芯片无关的应用如fastbo ...
- Glide的 java.lang.RuntimeException: Expected instanceof GlideModule, but found:X.GlideModule@2e4554f
问题一 在添加过混淆规则后,App打包的时候,发现报错了 java.lang.RuntimeException: Expected instanceof GlideModule, but found: ...
- dede二级导航
{dede:channelartlist} {dede:field name='typeurl'/}'——{dede:field name='typename'/} {dede:channel typ ...
- 转:Git Submodule管理项目子模块
使用场景 当项目越来越庞大之后,不可避免的要拆分成多个子模块,我们希望各个子模块有独立的版本管理,并且由专门的人去维护,这时候我们就要用到git的submodule功能. 常用命令 git clone ...
- Windows Management Instrumentation 服务卸载并重新创建
SC delete Winmgmt sc create Winmgmt binPath= "C:\Windows\System32\svchost.exe -k netsvcs" ...
- 当锚点遇到fixed
问题:页面内容导航fixed+锚点错位 solution: 锚点定位跟外边距没有关系. 我们使用内边距padding-top=fixed导航高度来使锚点可以精准定位: 此时新的问题产生了,内边距的存在 ...
- python小白——进阶之路——day2天-———数据类型和Number类型和str字符串
### -python的六大标准数据类型(1)Number 数字类型(int float bool complex)(2)String 字符串类型(3)List 列表类型(4)Tuple 元组类型(5 ...