比赛连接: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. VS如何在调试时进入到dll文件

    背景:    项目A:用C#写的一个类库文件 项目B:引用项目A的dll文件,完成编码,也是C#编写的. 需求:怎么能在调试的时候,调试断点能够从项目B中进入项目A中的代码. 解决办法就是: 假设,项 ...

  2. [转帖]Windows 10新预览版上线:可直接运行任意安卓APP了

    Windows 10新预览版上线:可直接运行任意安卓APP了 http://www.pcbeta.com/viewnews-80316-1.html 今晨(3月13日),微软面向Fast Ring(快 ...

  3. Latex常用软件

    Linux texMaker sudo apt-get install texlive-full sudo apt-get install texmaker

  4. ResultHandler的用法

    ResultHandler,顾名思义,对返回的结果进行处理,最终得到自己想要的数据格式或类型.也就是说,可以自定义返回类型.下面通过一个例子讲解它的使用方法: 创建Goods实体类: public c ...

  5. getMessage(),getFile,getLine获取异常用法

    try { $param = $request->all(); $param['building_id'] = 0; $param['sync'] = 2; // 1小程序2App $param ...

  6. __new__和__init__的区别

    __new__是一个静态方法,而__init__是一个实例方法. __new__方法会返回一个创建的实例,而__init__什么都不返回. 只有在__new__返回一个cls的实例时后面的__init ...

  7. 补充:pyhton 2 和3中的beyts类型

    在python2里,bytes == str python2里还有个单独的类型是unicode , 把字符串解码后,就会变成unicode. 既然python2中byets == str,那为什么还要 ...

  8. js发布订阅模式实现

    //可以用于无相关页面或组件的事件.数据传递,减少在onShow中的业务,降低代码耦合 let events = {} /**订阅**/ function on(name, self, callbac ...

  9. mysql数据库修改数据表引擎的方法

    对于MySQL数据库,如果你要使用事务以及行级锁就必须使用INNODB引擎.如果你要使用全文索引,那必须使用myisam. INNODB的实用性,安全性,稳定性更高但是效率比MYISAM稍差,但是有的 ...

  10. 用python写一个预警机器人(支持微信和钉钉)

    背景 线上的系统在运行中,发生故障时怎么及时的通过手机通知到相关人员?当然这是个很简单的需求,现有的方法有很多,例如: 如果我们用的云产品,那么一般都会有配套对应的监控预警功能,根据需要配置一下即可, ...