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的更多相关文章
- 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 ...
- 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 ...
- 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 ...
- 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 ...
- 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 ...
- 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 ...
- 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 ...
- 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 ...
- 2015 ACM / ICPC 亚洲区域赛总结(长春站&北京站)
队名:Unlimited Code Works(无尽编码) 队员:Wu.Wang.Zhou 先说一下队伍:Wu是大三学长:Wang高中noip省一:我最渣,去年来大学开始学的a+b,参加今年区域赛之 ...
- (并查集)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 ...
随机推荐
- laravel log改为时间格式
1 providers新建文件 LogRotateServiceProvider.php <?php namespace App\Providers; use Monolog\Formatter ...
- spark、standalone集群 (1)
1.配置 spark/apache/org 下载解压, 安装jdk1.8 2.准备服务器 3.设置hostname 4.关闭防火墙 开启: service iptables start 关闭: ser ...
- 获取打开页面时的当前时间(yyyy-MM-dd hh:mm:ss)
Date.prototype.Format = function (fmt) { var o = { "M+": this.getMonth() + 1, //月份 "d ...
- Spring Boot+Jsp启动异常
No Java compiler available for configuration options compilerClassName 加入maven配置 <dependency> ...
- 非关系型数据库----MongoDB
一.什么是MongoDB? MongoDB 是由C++语言编写的,是一个基于分布式文件存储的开源数据库系统. 在高负载的情况下,添加更多的节点,可以保证服务器性能. MongoDB 旨在为WEB应用提 ...
- sonar结合jenkins
一.下载jenkins插件 二.系统设置 三.获取token值 4.调整 Jenkins 构建设置
- Python 版百度站长平台链接主动推送脚本
如果自己的网站需要被百度收录,可以在搜索结果中找到,就需要将网站的链接提交给百度.依靠百度的爬虫可能无法检索到网站所有的内容,因此可以主动将链接提交给百度. 在百度的站长平台上介绍了链接提交方法,目前 ...
- 莫烦scikit-learn学习自修第三天【通用训练模型】
1. 代码实战 #!/usr/bin/env python #!_*_ coding:UTF-8 _*_ import numpy as np from sklearn import datasets ...
- 莫烦theano学习自修第十天【保存神经网络及加载神经网络】
1. 为何保存神经网络 保存神经网络指的是保存神经网络的权重W及偏置b,权重W,和偏置b本身是一个列表,将这两个列表的值写到列表或者字典的数据结构中,使用pickle的数据结构将列表或者字典写入到文件 ...
- springboot+jpa+mysql+swagger整合
Springboot+jpa+MySQL+swagger整合 创建一个springboot web项目 <dependencies> <dependency> < ...