HDU 3622 Bomb Game(2-sat)】的更多相关文章

HDU 3622 Bomb Game 题目链接 题意:求一个最大半径,使得每一个二元组的点任选一个,能够得到全部圆两两不相交 思路:显然的二分半径,然后2-sat去判定就可以 代码: #include <cstdio> #include <cstring> #include <cstdlib> #include <vector> #include <cmath> #include <algorithm> using namespace…
Bomb Game Time Limit: 10000/3000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 5396    Accepted Submission(s): 1925 Problem Description Robbie is playing an interesting computer game. The game field is an unbounde…
Bomb Game Time Limit: 10000/3000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 2951    Accepted Submission(s): 984 Problem Description Robbie is playing an interesting computer game. The game field is an unbounded…
Bomb Game Time Limit: 10000/3000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 3881    Accepted Submission(s): 1346 Problem Description Robbie is playing an interesting computer game. The game field is an unbounded…
Description \(n\) 个炸弹,每个炸弹有两个放置点,可以任选一个,问你最大的半径是多少. Sol 二分+2-SAT+Tarjan. 首先二分一下答案.然后就成了一个2-SAT问题. 建模就是, \(i\) 如果和 \(j\) 的距离超过 \(x*2\),那么 \(i\) 只能选择 \(j\) ^ \(1\) 连边,同时 \(j\) 只能选择 \(i\) ^ \(1\) 连边. 最后用Tarjan所以下环,如果两个点在一个环中,那么就不合法. Code #include <bits/…
题意:有一个游戏,有n个回合,每回合可以在指定的2个区域之一放炸弹,炸弹范围是一个圈,要求每回合的炸弹范围没有重合.得分是炸弹半径最小的值.求可以得到的最大分数. 思路:二分+2SAT. 二分炸弹范围,再根据有无重合建图,用2SAT判定. #include <cstdio> #include <cmath> #include <vector> #include <cstring> using namespace std; ; struct TwoSAT {…
用read()会挂 二分半径,显然最优的是所有原都用这个最小半径,然后2-SAT把相交的圆建图,跑tarjan判一下可行性即可 #include<iostream> #include<cstdio> #include<cstring> #include<cmath> using namespace std; const int N=205; int n,h[N],cnt,dfn[N],low[N],tot,s[N],top,bl[N],col; bool v…
题目大意:玩一个放炸弹游戏,有N次放炸弹的机会,每次放炸弹时,你都有两个位置能够选择.问怎样放炸弹,能使爆炸的炸弹的半径的最小值最大(炸弹爆炸半径能够控制,可是爆炸形成的圈不能有重叠部分) 解题思路:最小值最大,二分 二分半径,假设有不满足的点,就建立起限制边.接着推断是否能完毕染色就可以 #include <cstdio> #include <cstring> #include <algorithm> #include <cmath> #include &…
p.MsoNormal { margin: 0pt; margin-bottom: .0001pt; text-align: justify; font-family: Calibri; font-size: 10.5000pt } h1 { margin-top: 5.0000pt; margin-bottom: 5.0000pt; text-align: center; font-family: 宋体; color: rgb(26,92,200); font-weight: bold; fo…
hdu 3555 Bomb 题意: 在1~N(1<=N<=2^63-1)范围内找出含有 ‘49’的数的个数: 与hdu 2089 不要62的区别:2089是找不不含 '4'和 '62'的区间范围内的数,此题是含有:正好相反,对于 "不要62"只是用第二位表示首位数字,这一题呢? 看转化:易知一定要要知道首位是9的个数,才能在前面加4得到 '49',但是什么状态能从不含 '49'转移到含 '49'?直接在不含'49'前加9,那么就出现了三个状态之间的递推转化,从而推出了第二维…
http://acm.hdu.edu.cn/showproblem.php?pid=3622 又是各种逗.. 2-SAT是一种二元约束,每个点可以置于两种状态,但只能处于一种状态,然后图是否有解就是2-SAT啦. 看白书吧. 这个图的边的概念一定要弄懂!以下的x'表示x的另一个点 边(x, y)表示取了x就一定取y,x是前提条件! 对于约束(x, y),取x但不取y,那么显然连边(x, y'), (y, x'),这个意思一定要懂,就是说取了x就取y的另一个,可以唯一确定:那么反之取了y就一定取x…
http://acm.hdu.edu.cn/showproblem.php?pid=3622 二分答案转化成2-sat问题. 上午测试时总想二分后把它转化成最大点独立集但是不会写最大点独立集暴力又秘制写错所以就爆零啦--- #include<cmath> #include<cstdio> #include<cstring> #include<algorithm> using namespace std; const int N = 503; double x…
题意: 就是给出n对坐标,每对只能选一个,以选出来的点为圆心,半径自定义,画圆,而这些圆不能覆盖,求半径最小的圆的最大值 解析: 看到最x值最x化,那二分变为判定性问题,然后...然后我就没想到... 好的吧...2-sat 还能在不是一对的两个值之间建边...求出连通分量后  看一对中的两个坐标是否在一个连通分量中 在一个说明半径太小 要加大  反之..反之. 因为涉及小数 要用eps #include <iostream> #include <cstdio> #include…
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=3555 Bomb Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/65536 K (Java/Others) 问题描述 The counter-terrorists found a time bomb in the dust. But this time the terrorists improve on the time bo…
Bomb Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 10    Accepted Submission(s): 3 Problem Description There are N bombs needing exploding.Each bomb has three attributes: exploding radius ri,…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3622 思路:二分是容易想到的,由于题目中有明显的矛盾关系,因此可以用2-sat来验证其可行性.关键是如何建图:对于每两对炸弹的(u,u')和(v,v'),如果u,vi的距离小于2*mid,则连边u->v',v->u‘.然后强连通判断可行性. http://paste.ubuntu.com/5972769/…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3555 Problem Description The counter-terrorists found a time bomb in the dust. But this time the terrorists improve on the time bomb. The number sequence of the time bomb counts from 1 to N. If the curre…
Bomb Problem Description There are N bombs needing exploding.Each bomb has three attributes: exploding radius ri, position (xi,yi) and lighting-cost ci which means you need to pay ci cost making it explode.If a un-lighting bomb is in or on the border…
题意 求区间[1,n]内含有相邻49的数. 思路 比较简单的按位DP思路.这是第一次学习记忆化搜索式的数位DP,确实比递推形式的更好理解呐,而且也更通用~可以一般化: [数位DP模板总结] int dfs(int pos, int pre, int flag, bool limit) { if (pos == -1) return flag==target_flag; if (!limit && ~dp[pos][pre][flag]) return dp[pos][pre][flag];…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3555 题目大意:从0开始到给定的数字N所有的数字中遇到“49”的数字的个数. Sample Input 3 1 50 500   Sample Output 0 1 15 Hint From 1 to 500, the numbers that include the sub-sequence "49" are "49","149","24…
Bomb Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/65536 K (Java/Others) Total Submission(s): 11804    Accepted Submission(s): 4212 Problem Description The counter-terrorists found a time bomb in the dust. But this time the terrorist…
Bomb Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/65536 K (Java/Others)Total Submission(s): 15102    Accepted Submission(s): 5452 Problem Description The counter-terrorists found a time bomb in the dust. But this time the terrorists…
Bomb Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/65536 K (Java/Others) Total Submission(s): 7926    Accepted Submission(s): 2780 Problem Description The counter-terrorists found a time bomb in the dust. But this time the terrorists…
hdu3622 Bomb Game Time Limit: 10000/3000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 3350 Accepted Submission(s): 1149 Problem Description Robbie is playing an interesting computer game. The game field is an unboun…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3555 题意:上一题是不要62 这个是"不要49" 代码: #include <stdio.h> #include <ctime> #include <math.h> #include <limits.h> #include <complex> #include <string> #include <functio…
链接: https://vjudge.net/problem/HDU-3555 题意: The counter-terrorists found a time bomb in the dust. But this time the terrorists improve on the time bomb. The number sequence of the time bomb counts from 1 to N. If the current number sequence includes…
Bomb Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/65536 K (Java/Others) Total Submission(s): 24148    Accepted Submission(s): 9092 Problem Description The counter-terrorists found a time bomb in the dust. But this time the terrorist…
RT. #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> using namespace std; ],ret=,dp[][][]; void get_bit(long long x) { ret=; ;x/=;} } long long dfs(long long pos,long long pre,bool flag1,long long flag2) {…
给出n,问所有[0,n]区间内的数中,不含有49的数的个数 数位dp,记忆化搜索 dfs(int pos,bool pre,bool flag,bool e) pos:当前要枚举的位置 pre:当前要枚举的位置的前面是否为4 flag:枚举当前时,这个数的49时候被算过了 e:当前位置是否可以随便取值 dp[pos][pre][flag] #include<cstdio> #include<cstring> #include<algorithm> #include<…
SG函数打表,求NIM和!!! 代码如下: #include<cstdio> #include<cstring> #include<iostream> #include<cmath> #include<algorithm> using namespace std; ][]; ]; void init() { int i,j,a,b,k; ]; ;i<=;i++){ sg[i][]=sg[][i]=i; } ;i<=;i++) ;j&l…