博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
HDU 3622 Bomb Game (二分+2-SAT)
阅读量:4467 次
发布时间:2019-06-08

本文共 1446 字,大约阅读时间需要 4 分钟。

题目地址:

先二分半径。然后小于该半径的不能选,对这些不能选的点对进行加边。然后推断可行性就可以。

代码例如以下:

#include 
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
using namespace std;#define LL __int64const int INF=0x3f3f3f3f;const double eqs=1e-3;int head[410], cnt, top, ans, index;int dfn[410], low[410], instack[410], stak[410], belong[410];struct node{ int u, v, next;}edge[1000000];struct Point{ int x, y;}dian[10000];void add(int u, int v){ edge[cnt].v=v; edge[cnt].next=head[u]; head[u]=cnt++;}void tarjan(int u){ dfn[u]=low[u]=++index; instack[u]=1; stak[++top]=u; for(int i=head[u];i!=-1;i=edge[i].next) { int v=edge[i].v; if(!dfn[v]) { tarjan(v); low[u]=min(low[u],low[v]); } else if(instack[v]) { low[u]=min(low[u],dfn[v]); } } if(dfn[u]==low[u]) { ans++; while(1) { int v=stak[top--]; instack[v]=0; belong[v]=ans; if(u==v) break; } }}void init(){ memset(head,-1,sizeof(head)); cnt=0; memset(dfn,0,sizeof(dfn)); memset(instack,0,sizeof(instack)); top=ans=index=0;}double dist(Point x, Point y){ return sqrt((x.x-y.x)*(x.x-y.x)*1.0+(x.y-y.y)*(x.y-y.y));}int solve(double mid, int n){ int i, j; init(); for(i=0;i
<<1;i++) { for(j=0;j
eqs) { mid=(l+r)/2; //printf("%.2lf\n",mid); if(solve(mid, n)) { ans=mid; l=mid; } else r=mid; } printf("%.2lf\n",ans/2.0); } return 0;}

转载于:https://www.cnblogs.com/jzdwajue/p/6802710.html

你可能感兴趣的文章
用 UIWebView 代替 UITextView,解决行间距问题
查看>>
学习秦九韶算法
查看>>
Mysql中use filesort的误区
查看>>
npm和Node.js简介
查看>>
Spring AOP无法拦截Controller的原因
查看>>
Windows双系统
查看>>
Microsoft Project项目管理工具
查看>>
软件设计师-算法
查看>>
小米手机安装Google框架
查看>>
honpeyhonepy
查看>>
netaddr网络地址工具python
查看>>
OSI7层模型和网络排错、网络安全
查看>>
hash文件-对文件进行数字签名
查看>>
TCP_Wrappers基础知识介绍
查看>>
Central Post Office (Shiraz University Local Contest 2011 ) 树状dp
查看>>
51Nod - 1031 骨牌覆盖
查看>>
回顾环信使用
查看>>
JavaScript--函数对象的属性caller与callee
查看>>
特殊字符大全
查看>>
SQL - SQL 连接 JOIN 例解。(左连接,右连接,全连接,内连接,交叉连接,自连接)[转]...
查看>>