bzoj2856: [ceoi2012]Printed Circuit Board
Description

Input
Output
#include<bits/stdc++.h>
typedef long long i64;
int min(int a,int b){return a<b?a:b;}
int max(int a,int b){return a>b?a:b;}
const int N=;
char buf[],*ptr=buf;
int _(){
int x=;
while(*ptr<)++ptr;
while(*ptr>)x=x*+*ptr++-;
return x;
}
struct pos{
double x,y;
double val()const{return x+y;}
}xs[N];
double operator*(pos a,pos b){return a.x*b.y-a.y*b.x;}
pos operator-(pos a,pos b){return (pos){a.x-b.x,a.y-b.y};}
int n;
struct vertex{
pos p;
int id,x;
bool operator<(vertex w)const{
double d=p*w.p;
return d?d<:p.val()<w.p.val();
}
}vs[N];
int ps[N],xp=;
bool un[N];
struct itv{
pos a,b;
int l,r;
double operator()(pos&w)const{
return w.val()*(b*a)/(w*(a-b));
}
}is[];
int mx;
void ins(itv&a,itv&b){
if(!a.r)a=b;
else{
int l=max(a.l,b.l),r=min(a.r,b.r);
if(a(xs[l])+a(xs[r])>b(xs[l])+b(xs[r]))a=b;
}
}
void ins(vertex a,vertex b){
itv w=(itv){a.p,b.p,a.x,b.x};
for(int l=a.x+mx-,r=b.x+mx+;r-l!=;l>>=,r>>=){
if(~l&)ins(is[l^],w);
if(r&)ins(is[r^],w);
}
}
int as[N],ap=;
int main(){
fread(buf,,sizeof(buf),stdin);
n=_();
for(mx=;mx<=n+;mx<<=);
for(int i=;i<=n;++i){
vs[i].p.x=_();
vs[i].p.y=_();
vs[i].id=i;
}
std::sort(vs+,vs+n+);
for(int i=,j=;i<=n;i=j){
for(++j;j<=n&&vs[i].p*vs[j].p==;un[vs[j].id]=,++j);
xs[++xp]=vs[i].p;
for(int k=i;k<j;++k)vs[k].x=xp;
}
for(int i=;i<=n;++i)ps[vs[i].id]=i;
ps[]=ps[n];
for(int i=;i<=n;++i){
int a=ps[i-],b=ps[i];
if(a>b)std::swap(a,b);
if(vs[a].x<vs[b].x)ins(vs[a],vs[b]);
}
for(int i=;i<=n;++i)if(!un[vs[i].id]){
for(int w=vs[i].x+mx;w;w>>=)if(is[w].r&&is[w](vs[i].p)<vs[i].p.val()-1e-){
un[vs[i].id]=;
break;
}
}
for(int i=;i<=n;++i)if(!un[i])as[ap++]=i;
printf("%d\n",ap);
for(int i=;i<ap;++i)printf("%d ",as[i]);
return ;
}
bzoj2856: [ceoi2012]Printed Circuit Board的更多相关文章
- Printed Circuit Board (board)
Printed Circuit Board (board) 题目描述 给出一个N个顶点的简单多边形,对于每个顶点,假如它和原点连成的线段只在这个顶点处和多边形相交,就称为满足要求的顶点.你的任务是输出 ...
- ZOJ1648 Circuit Board 2017-04-18 20:31 34人阅读 评论(0) 收藏
Circuit Board Time Limit: 2 Seconds Memory Limit: 65536 KB On the circuit board, there are lots ...
- ZOJ 1648 Circuit Board(计算几何)
Circuit Board Time Limit: 2 Seconds Memory Limit: 65536 KB On the circuit board, there are lots of c ...
- ZOJ1648 Circuit Board(线段相交)
裸的判断线段相交
- kickstart2019 round_C B. Circuit Board
思路: 这题应该不止一种解法,其中的一种可以看作是leetcode85https://www.cnblogs.com/wangyiming/p/11059176.html的加强版: 首先对于每一行,分 ...
- zoj 1648 Circuit Board
题目:意思就是推断给定的几条线段是否有相交的. 方法:模版吧,有空在来细细学习. 代码: #include <iostream> #include <cstdio> using ...
- bzoj AC倒序
Search GO 说明:输入题号直接进入相应题目,如需搜索含数字的题目,请在关键词前加单引号 Problem ID Title Source AC Submit Y 1000 A+B Problem ...
- COB(Chip On Board) 工艺技术
COX(Chip On X) •X 基板: PCB (Printed circuit board) FPC (Flexible Printed Circuit) Glass •导线焊接 球形焊接 ...
- 特邀美国EMC实战专家Mark来华授课
“轻松搞定EMC-PCB和系统设计”课程介绍 本次课程特邀美国EMC领域权威专家Mark Montrose主讲,将涵盖满足产品电磁兼容性和信号完整性的基本原理.课程涉及多个领域,不仅仅针对PCB设计, ...
随机推荐
- jquery选择后代以及toggle,toggleClass用法
$("#id").find(".classname") 选择id为xx下的类名为xx的元素 toggle $(this).next(".c ...
- 陕西师范第七届I题----排队
链接:https://www.nowcoder.com/acm/contest/121/I来源:牛客网 题目描述 ACM竞赛队内要开运动会啦!!!! 竞赛队内的一群阳光乐观积极的队员们迅速的在操场上站 ...
- POJ 3468:A Simple Problem with Integers(线段树区间更新模板)
A Simple Problem with Integers Time Limit: 5000MS Memory Limit: 131072K Total Submissions: 141093 ...
- hdu5173 How Many Maos Does the Guanxi Worth
#include<bits/stdc++.h> using namespace std; #define INF 0x3f3f3f3f ]; ]; ][]; void dijkstra(i ...
- 【java编程】加载Resources配置文件的方法
一.加载配置实现k-v //FILTER_PROPERTY_NAME=META-INF/abc.properties private void loadFilterConfig(Properties ...
- Python面试 【315+道题】
Python面试 [315+道题] 第一部分 Python基础篇(80题) 为什么学习Python? 因为看到python的发展趋势,觉得需要与时俱进,第一点,python开发速度极快,能快速完成一个 ...
- jdreact转换为H5注意事项
1:先执行npm install 然后执行 npm run web-init 配置完后 在执行 npm run web-start(注意的是不要根据文档执行 yarn add -D @jdreact ...
- smb文件共享实现
samba文件共享 首先安装软件 yum install samba -y 编辑配置文件 /etc/samba/smb.conf ,在文章最后添加以下内容 [smbtest] content = do ...
- KMPlayer速度步进设置及快捷键设置和同级视频自动加入播放列表
速度步进设置 快捷键设置 同级视频自动加入播放列表
- Python---Pycharm如何直接上传自己的代码到GitHub
请提前到官网注册GitHub账号,提前在terminal或者cmd安装git,然后你要检测自己电脑是否存在 SSH key,然后需要把SSH key复制下来,粘贴到你的GitHub. - 第一步:安装 ...