1011-广告

T1

堆优化,枚举删除数量贪心。

#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
#include <queue>
#define N 1111111
#define LL long long

using namespace std;
struct BLO{
	LL x,y;
	int id;
	friend bool operator < (const BLO &a,const BLO &b){
		return a.y>b.y;
	}
};
priority_queue<BLO>yq;
BLO arr[N];
int pn,dn;
bool isd[N];
LL ans=0;
int main(){
//	freopen("data/d2.in","r",stdin);\
	freopen("d.out","w",stdout);
	int T;
	scanf("%d",&T);
	while(T--){
		while(!yq.empty())yq.pop();
		ans=0;
		scanf("%d%d",&pn,&dn);
		for(int i=1;i<=pn;i++){
			scanf("%lld%lld",&arr[i].x,&arr[i].y);
			arr[i].id=i;
		}
		sort(arr+1,arr+pn+1,[](const BLO &a,const BLO &b){return a.x<b.x;});
		for(int i=dn+1;i<=pn;i++)
			yq.push(arr[i]);
		for(int i=dn;i>=0;i--){
			ans=max(ans,yq.top().y*arr[i+1].x);
			if(arr[i].y>yq.top().y){
				yq.pop();
				yq.push(arr[i]);
			}
		}
		printf("%lld\n",ans);
	}
}

T2

树上主席树,没过……

T3

咕掉了。

反思?

嗯,意识到自己的渺小……

我不知道是不是选择了错误的道路。

但是我知道只有走一走才有方向。


 

 

 

 

 

 

 

 

 

广告预警

 

 

 

 

 

 

 

 


大力安利一波$Vim$

主要说$diff$模式。

只要会用$diffsplit$就好啦

可以简单口胡教程 (为了防止没有配置文件的人喷我,这是裸的$Vim$)。

首先用$Vim$打开样例输出。

 

大概长这样:

然后写 :diffsplit 你的输出 

然后如果你WA了。就会长这样……错误一目了然……

如果你AC了,就长这样……神清气爽……

当然加了配置文件的更好看辣……

还有一件事,××我忘了存代码了啊啊啊190行的树啊啊啊啊!呜呜……

posted @ 2019-10-12 10:56  Miemeng_麦蒙  阅读(151)  评论(0编辑  收藏  举报

小麦在雨中,蒙蒙的雾气

麦蒙不想有人骚扰他,如果有必要 联系 QQ:1755601414

如果你嫌广告大,那就喷我吧,不是博客园的锅。