bzoj1913: [Apio2010]signaling 信号覆盖
题解传送门
//Achen
#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdlib>
#include<vector>
#include<cstdio>
#include<queue>
#include<cmath>
#define pi acos(-1)
#define eps 1e-15
const int N=1e5+;
#define For(i,a,b) for(int i=(a);i<=(b);i++)
#define Rep(i,a,b) for(int i=(a);i>=(b);i--)
typedef long long LL;
typedef double db;
using namespace std;
int n,cnt;
LL c1,c2,tp;
db a[N],ans; template<typename T>void read(T &x) {
char ch=getchar(); x=; T f=;
while(ch!='-'&&(ch<''||ch>'')) ch=getchar();
if(ch=='-') f=-,ch=getchar();
for(;ch>=''&&ch<='';ch=getchar()) x=x*+ch-''; x*=f;
} struct pt {
db x,y;
}p[N]; LL C(int n,int m) {
LL rs=;
Rep(i,n,n-m+) rs*=i;
For(i,,m) rs/=i;
return rs;
} int main() {
read(n); tp=C(n-,);
For(i,,n) scanf("%lf%lf",&p[i].x,&p[i].y);
For(i,,n) {
cnt=;
For(j,,n) if(j!=i)
a[++cnt]=atan2(p[j].y-p[i].y,p[j].x-p[i].x);
For(i,,cnt) {
if(a[i]<) a[i]+=pi*;
a[cnt+i]=a[i]+pi*;
}
sort(a+,a+*cnt+);
int r=; c1=;
For(l,,cnt) {
while(r<*cnt&&a[r+]-a[l]<pi)
r++;
if(r-l) c1+=C(r-l,);
}
c2+=tp-c1;
}
ans=(db)(c2+(C(n,)-c2)*)/(db)C(n,)+;
printf("%.6lf\n",ans);
return ;
}
bzoj1913: [Apio2010]signaling 信号覆盖的更多相关文章
- bzoj1913[Apio2010]signaling 信号覆盖 计算几何
1913: [Apio2010]signaling 信号覆盖 Time Limit: 20 Sec Memory Limit: 64 MBSubmit: 1583 Solved: 646[Subm ...
- 【BZOJ-1913】signaling信号覆盖 极角排序 + 组合
1913: [Apio2010]signaling 信号覆盖 Time Limit: 20 Sec Memory Limit: 64 MBSubmit: 1232 Solved: 506[Subm ...
- 【bzoj1913】 Apio2010—signaling 信号覆盖
http://www.lydsy.com/JudgeOnline/problem.php?id=1913 (题目链接) 题意 给出一个平面上n个点,求任选3个点画一个圆所包含的点的期望值. Solut ...
- bzoj 1913: [Apio2010]signaling 信号覆盖【旋转卡壳(?)】
参考:https://blog.csdn.net/qpswwww/article/details/45334033 讲的很清楚 做法比较像旋转卡壳但是具体是不是我也不清楚.. 首先知道只要求出每种方案 ...
- 【BZOJ】1913: [Apio2010]signaling 信号覆盖(计算几何+计数)
题目 传送门:QWQ 分析 人类智慧题,不会做...... 详细题解1 详细题解2 总体思路是考虑四边形 讨论凹四边形凸四边形,最后加一个单调性优化省掉个$ O(n) $ 代码 代码感觉好短 ...
- [BZOJ 1913] signaling 信号覆盖
Link:https://www.lydsy.com/JudgeOnline/problem.php?id=1913 TIP:(注意,这题只能输出6位才能过,7位都不行wtf?) Algorithm: ...
- [BZOJ1913][APIO2010]信号覆盖(计算几何+计数)
1913: [Apio2010]signaling 信号覆盖 Time Limit: 20 Sec Memory Limit: 64 MBSubmit: 1658 Solved: 672[Subm ...
- [BZOJ1911][BZOJ1912][BZOJ1913]APIO2010解题报告
特别行动队 Description 这个好像斜率优化不是一般地明显了啊...只不过要分a的正负两种情况考虑是维护上凸还是下凸 /********************************** ...
- 家用wifi信号覆盖增强扩展实用指南
家用wifi信号覆盖增强扩展实用指南 现在网上很多号称穿墙王的无线路由器,但是一般用起来效果都不理想,其实最主要的原因还是家里面一般每个房间不大,但是墙比较多.并且一般也没有一个所谓的中心点放置路由器 ...
随机推荐
- UVA 240 Variable Radix Huffman Encoding
题目链接:https://vjudge.net/problem/UVA-240 题目大意 哈夫曼编码是一种最优编码方法.根据已知源字母表中字符出现的频率,将源字母表中字符编码为目标字母表中字符,最优的 ...
- [kuangbin带你飞]专题一 简单搜索 - L - Oil Deposits
#include<iostream> #include<cstdio> #include<cstring> #include<algorithm> #i ...
- Android Telephony分析(二) ---- RegistrantList详解
前言 本文主要讲解RegistrantList的原理,以及如何快速分析RegistrantList相关的代码流程.在Telephony模块中,在RIL.Tracker(ServiceStateTrac ...
- postgres优化项及linux上pg操作记录
1.linux切换到pg命令: $ su - postgres $ psql postgres=# 2.查看/退出pg ps -ef |grep postgres postgres=# \q 3.一般 ...
- DIV+CSS网页布局常用的一些基础知识
CSS命名规范 一.文件命名规范 全局样式:global.css:框架布局:layout.css:字体样式:font.css:链接样式:link.css:打印样式:print.css: 二.常用类/I ...
- SolrCloud6.1.0之SQL查询测试
Solr发展飞快,现在最新的版本已经6.1.0了,下面来回顾下Solr6.x之后的一些新的特点: (1)并行SQL特性支持,编译成Streaming 表达式,可以在solrcloud集群中,并行执行 ...
- CSV导入到hive中,处理分号问题
1.导入的原数据 103744;545479945;2017.05.17 06:41:08;sell;eurusd_;0.10;1.11080;1.11280;1.10880;1.11081;0.00 ...
- 人脸识别-常用的数据库Face Databases From Other Research Groups
Static/Videos Static Single/Multiple faces Single? Gray/Color Color Resolution Vaious Face pose Fron ...
- Algo: Basic
1. 二维数组的查找 2. 替换空格 3. 从尾到头打印链表 4. 重建二叉树 5. 用两个栈实现队列 6. 旋转数组的最小数字 7. 斐波那契数列 8. 跳台阶 9. 变态跳台阶 10. 矩阵覆盖 ...
- C++: string copy-on-write
https://blog.csdn.net/haoel/article/details/24058 https://www.cnblogs.com/promise6522/archive/2012/0 ...