zoukankan      html  css  js  c++  java
  • 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
    ",ans);
    	}
    }
    

    T2

    树上主席树,没过……

    T3

    咕掉了。

    反思?

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

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

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


     

     

     

     

     

     

     

     

    广告预警

     

     

     

     

     

     

     

     


    大力安利一波$Vim$

    主要说$diff$模式。

    只要会用$diffsplit$就好啦

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

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

     

    大概长这样:

    然后写 :diffsplit 你的输出 

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

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

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

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

  • 相关阅读:
    Mysql:用户操作命令
    Cookie和Set-Cookie
    Matcher中appendReplacement()方法与replaceAll()方法的联系
    记录一次mysql执行异常(磁盘空间)
    ehcache简单配置
    md5
    mysql后台运行简单的备份脚本
    shell脚本研习
    SpringBoot根据条件,去注入需要的Bean
    springboot后台跨域设置
  • 原文地址:https://www.cnblogs.com/kalginamiemeng/p/Exam20191011.html
Copyright © 2011-2022 走看看