比赛连接: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. Hbase获取流程

    1\\.客户端chou操作 2.服务器dauncaozuo操作 3\存储优化

  2. hive条件函数

    case相当于if,when相当于=:then是条件满足的结论.否则实行else后语句,一end结束

  3. lombok 使用 Idea

    Lombok 是一种 Java™ 实用工具,可用来帮助开发人员消除 Java 的冗长,尤其是对于简单的 Java 对象(POJO).它通过注解实现这一目的.import lombok.Getter;i ...

  4. Python 常用模块总结

    模块的分类: 1.内置模块(python自带的比如像os,sys等模块)    2.自定义模块,自己写的一些模块    3.第三方模块(开源模块) 模块导入: 1.import sys         ...

  5. PHPWord插件详解

    一下载PHPWorld并配置项目 1.PHPWord框架文件如下: 二使用word模板并使用PHPWord生成doc文件 例如:源代码如下: <?php require_once '../PHP ...

  6. 【数学建模】day08-数理统计III

    2. 回归分析 回归分析与曲线拟合区分. 曲线拟合是,根据得到的若干有关变量的一组数据,寻找因变量与(一个或几个)自变量之间的一个函数,使这个函数对那组数据拟合得好.通常,函数的形式可以由经验.先验知 ...

  7. windows开关机事件

    开关机事件.xml <ViewerConfig> <QueryConfig> <QueryParams> <Simple> <BySource&g ...

  8. mysql 下载地址

    新浪的镜像站 http://mirrors.sohu.com/mysql yum安装: 首先要到MySQL yum库的下载页面http://dev.mysql.com/downloads/repo/y ...

  9. HDU5745-La Vie en rose-字符串dp+bitset优化

    这题现场的数据出水了,暴力就能搞过. 标解是拿bitset做,转移的时候用bitset优化过的操作(与或非移位)来搞,复杂度O(N*M/w) w是字长 第一份标程的思路很清晰,然而后来会T. /*-- ...

  10. DrawableAnimation小练习

    DrawableAnimation,也就是帧动画,将图片一张张显示出来,从而形成动画的效果 先在项目文件夹下新建一个目录drawable,然后在里面新建一个xml文件,自定义文件名,我的叫my_ani ...