比赛连接:ACM-ICPC 2015 BeiJing

本次比赛只写了 A G     然后 I题随后补

A

有一个正方形土地,上面有若干块绿洲。让你以x0为界限划一条竖线,要求左边绿洲面积>=右边绿洲面积且两者面积最接近。另外要求左边的土地总面积最大。求x0

二分 or 扫描线

// 二分
#include<bits/stdc++.h>
using namespace std;
#define maxn 100010
#define LL long long
struct ac{
  LL  x,y,l,h;
}a[maxn];
LL n;
bool cmp(ac q,ac w){
   return q.x<w.x;
}
LL work(LL mid){
    LL ans=;
    ;j<n;j++){
        if(a[j].l+a[j].x<=mid){
            ans+=a[j].l*a[j].h;
        }
        else if(a[j].x<=mid&&(a[j].x+a[j].l)>=mid){
            ans+=(mid-a[j].x)*a[j].h;
        }else return ans;
    }
    return ans;
}
int  main(){
   LL  t;
   cin>>t;
   while(t--){
      LL  r,sum=;
      cin>>r>>n;
      ;j<n;j++){
         cin>>a[j].x>>a[j].y>>a[j].l>>a[j].h;
         if(a[j].x+a[j].l>=r){
           a[j].l=r-a[j].x;
         }
         sum+=a[j].l*a[j].h;
      }
      //cout<<sum<<endl;
      sort(a,a+n,cmp);
      LL  ll=,rr=r+,ans;
      while(ll<rr){
         LL  mid=(ll+rr)/;
         ans=;
         LL ans=work(mid);
         <sum){
             ll=mid+;
         }else rr=mid;
      }
      //cout<<ll<<" "<<rr<<endl;
      ans=work(ll);
      while(work(ll)<=ans&&ll<=r){
          ll++;
      }
      cout<<ll-<<endl;
   }
}

// 扫描线
#include<bits/stdc++.h>
using namespace std;
#define maxn 1000010
#define LL long long
LL  a[maxn];
int main(){
   LL  t;
   cin>>t;
   while(t--){
      LL  n,r,sum=;
      cin>>r>>n;
      memset(a,,sizeof(a));
      ;j<n;j++){
         LL  x,y,z,zz;
         cin>>x>>y>>z>>zz;
         ;k<=x+z;k++){
            a[k]+=zz;
         }
         sum+=(min(r,x+z)-x)*zz;
      }
      LL  ans=,j;
      ;j<r&&ans*<sum;j++){
         ans+=a[j];
         //cout<<ans<<" "<<j<<endl;
      }
      &&j<=r){
         j++;
      }
      cout<<j-<<endl;
   }
}

G

给你四个矩形 选出来三个看是否可以组成新的矩阵

数据很小直接全排列暴力枚举

#include<bits/stdc++.h>
using namespace std;
struct ac{
  int x,y;
}a[];
];
bool work(){
   ;
   ]].x;
   ]].y;
   ]].x;
   ]].y;
   ]].x;
   ]].y;
   if(w==ww){
      h+=hh;
      i=;
   }else if(w==hh){
     h+=ww;
     i=;
   }else if(h==ww){
     w+=hh;
     i=;
   }else if(h==hh){
     w+=ww;
     i=;
   }
   ) ;
   i=;
   if(www==w){
      i=;
   }else if(w==hhh){
     i=;
   }else if(h==www){
     i=;
   }else if(h==hhh){
     i=;
   }
   if(i)
    ;
   ;
}
int main(){
    int t;
    cin>>t;
    while(t--){
       ;j<;j++){
          cin>>a[j].x>>a[j].y;
          b[j]=j;
       }
       ;
       do{
         if(work()){
            fa=;
            break;
         }
       }));
       if(fa){
          cout<<"Yes"<<endl;
       }else cout<<"No"<<endl;
    }
}

ACM-ICPC 2015 BeiJing的更多相关文章

  1. ACM ICPC 2015 Moscow Subregional Russia, Moscow, Dolgoprudny, October, 18, 2015 G. Garden Gathering

    Problem G. Garden Gathering Input file: standard input Output file: standard output Time limit: 3 se ...

  2. ACM ICPC 2015 Moscow Subregional Russia, Moscow, Dolgoprudny, October, 18, 2015 D. Delay Time

    Problem D. Delay Time Input file: standard input Output file: standard output Time limit: 1 second M ...

  3. ACM ICPC 2015 Moscow Subregional Russia, Moscow, Dolgoprudny, October, 18, 2015 I. Illegal or Not?

    I. Illegal or Not? time limit per test 1 second memory limit per test 512 megabytes input standard i ...

  4. ACM ICPC 2015 Moscow Subregional Russia, Moscow, Dolgoprudny, October, 18, 2015 K. King’s Rout

    K. King's Rout time limit per test 4 seconds memory limit per test 512 megabytes input standard inpu ...

  5. ACM ICPC 2015 Moscow Subregional Russia, Moscow, Dolgoprudny, October, 18, 2015 H. Hashing

    H. Hashing time limit per test 1 second memory limit per test 512 megabytes input standard input out ...

  6. ACM ICPC 2015 Moscow Subregional Russia, Moscow, Dolgoprudny, October, 18, 2015 C. Colder-Hotter

    C. Colder-Hotter time limit per test 1 second memory limit per test 512 megabytes input standard inp ...

  7. ACM ICPC 2015 Moscow Subregional Russia, Moscow, Dolgoprudny, October, 18, 2015 A. Anagrams

    A. Anagrams time limit per test 1 second memory limit per test 512 megabytes input standard input ou ...

  8. hdu 5444 Elven Postman(二叉树)——2015 ACM/ICPC Asia Regional Changchun Online

    Problem Description Elves are very peculiar creatures. As we all know, they can live for a very long ...

  9. 2015 ACM / ICPC 亚洲区域赛总结(长春站&北京站)

    队名:Unlimited Code Works(无尽编码)  队员:Wu.Wang.Zhou 先说一下队伍:Wu是大三学长:Wang高中noip省一:我最渣,去年来大学开始学的a+b,参加今年区域赛之 ...

  10. (并查集)Travel -- hdu -- 5441(2015 ACM/ICPC Asia Regional Changchun Online )

    http://acm.hdu.edu.cn/showproblem.php?pid=5441 Travel Time Limit: 1500/1000 MS (Java/Others)    Memo ...

随机推荐

  1. 生命周期函数以及vue的全局注册

    beforeCreate 在创造实例之前 created 创造实例以后 beforeMount 在挂载前 render 渲染节点到页面上 //将虚拟dom数组渲染出来 mounted 挂载以后 bef ...

  2. Javascript与C#对变量的处理方式

      先来看一下Javascript的情况(下面所说的基本类型和简单类型是一个意思): Javascript中变量会存在两种情况,一种是基本类型的,一共有五种,有null.Bollean.undefin ...

  3. Docker 给 故障停掉的 container 增加 restart 参数

    操作过程见图: 执行的命令比较简单: docker container update --restart=always containername 即可.

  4. taro 与uni-app对比

    https://www.jianshu.com/p/03e08399587e   (copy)

  5. Python基础知识1-基础语法

    pyenv--版本管理工具(后续再补)可参见https://www.jianshu.com/p/8aaf2525fa80 冯诺依曼体系架构 编程基础 语言分类  低级语言到高级语言 高级语言 程序Pr ...

  6. 老男孩python学习自修第十天【三元表达式与lambda表达式】

    例如: 1.使用三元表达式给变量赋值 result = '空' if x == None else x 2.使用lambda定义函数 add = lambda x, y: x+y

  7. webpack模塊打包機

    https://blog.csdn.net/qq_38277366/article/details/82907894

  8. js 持续访问保持session对象不消失

    $(function(){ publicBusi(); }) //实时刷新登录用户信息 function publicBusi(){ setTimeout(publicBusi,1000*60*10) ...

  9. Lodop提示安装或升级的注意事项

    LODOP的LodopFuncs.js文件里,自动判断浏览器类型提示下载哪个,根据版本号比较判断提示升级.此文章是以前写的,图示可能过旧,新版提示不同,但是LodopFuncs.js里各个方面变动不大 ...

  10. Linux CentOS7 开启80,443端口外网访问权限

    一.查看系统防火墙状态(如果返回 running 代表防火墙启动正常) firewall-cmd --state 二.开启端口外网访问 1.添加端口 返回 success 代表成功(--permane ...