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< ...
随机推荐
- Linux常用查找命令
第一种:grep命令 示例: 第二种:find命令 示例: 第三种:locate命令 示例: 第四种:whereis命令 示例: 第五种:which命令 示例:
- arcgis api 4.x for js之基础地图篇
arcgis api3.x for js转向arcgis api4.x,我也是最近的3-4个月时间的事情,刚好公司有个webgis项目需要展示三维场景,项目选择arcgis api4.x.我纯碎记录一 ...
- QT中使用google breakpad捕获程序崩溃异常
今天给大家介绍一个在linux下如何捕获程序崩溃异常的方法 一.google breakpad源码的下载和编译 1.https://github.com/google/breakpad.git,源码地 ...
- SwaggerAPI注解详解,以及注解常用参数配置
注解 @Api: 作用在类上,用来标注该类具体实现内容.表示标识这个类是swagger的资源 . 参数: tags:可以使用tags()允许您为操作设置多个标签的属性,而不是使用该属性. descri ...
- [20190416]process allocation latch.txt
[20190416]process allocation latch.txt --//看链接:http://andreynikolaev.wordpress.com/2010/12/16/hidden ...
- 数据加密--详解 RSA加密算法 原理与实现
RSA算法简介 RSA是最流行的非对称加密算法之一.也被称为公钥加密.它是由罗纳德·李维斯特(Ron Rivest).阿迪·萨莫尔(Adi Shamir)和伦纳德·阿德曼(Leonard Adlema ...
- leetcode题解-122买卖股票的最佳时期
题目 leetcode题解-122.买卖股票的最佳时机:https://www.yanbinghu.com/2019/03/14/30893.html 题目详情 给定一个数组,它的第 i 个元素是一支 ...
- 如莲开发平台(MIS基础框架、Java技术、B/S结构)
关于 「如莲」是一套MIS类系统基础框架,主要用于各类“管理信息系统”的开发,也适合做网站后台开发.可省去开发时的框架搭建.规范约定.权限管理等基础工作,直接专注于业务功能实现. 「如 ...
- 蚂蚁 uva 10881
思路: 一,两个点相撞然后,相互弹开.这样其实和两个点穿过去差不多, 但是对于单个点而言,这样肯定不行. 二,当你发现了不管什么情况,这些点的相对位置是不变的, 比如 1, 4, 3, 2 不管怎么移 ...
- Hive JDBC:java.lang.RuntimeException: org.apache.hadoop.ipc.RemoteException(org.apache.hadoop.security.authorize.AuthorizationException): User: root is not allowed to impersonate anonymous
今天使用JDBC来操作Hive时,首先启动了hive远程服务模式:hiveserver2 &(表示后台运行),然后到eclipse中运行程序时出现错误: java.sql.SQLExcepti ...