# hdu5299 Circles Game

321 篇文章 10 订阅
148 篇文章 0 订阅
3 篇文章 0 订阅

## Circles Game

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 1427    Accepted Submission(s): 451

Problem Description
There are n circles on a infinitely large table.With every two circle, either one contains another or isolates from the other.They are never crossed nor tangent.
Alice and Bob are playing a game concerning these circles.They take turn to play,Alice goes first:
1、Pick out a certain circle A,then delete A and every circle that is inside of A.
2、Failling to find a deletable circle within one round will lost the game.
Now,Alice and Bob are both smart guys,who will win the game,output the winner's name.

Input
The first line include a positive integer T<=20,indicating the total group number of the statistic.
As for the following T groups of statistic,the first line of every group must include a positive integer n to define the number of the circles.
And the following lines,each line consists of 3 integers x,y and r,stating the coordinate of the circle center and radius of the circle respectively.
n≤20000，|x|≤20000，|y|≤20000，r≤20000。

Output
If Alice won,output “Alice”,else output “Bob”

Sample Input


2
1
0 0 1
6
-100 0 90
-50 0 1
-20 0 1
100 0 90
47 0 1
23 0 1



Sample Output


Alice
Bob



Author
FZUACM

Source

#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<set>
#define F(i,j,n) for(int i=j;i<=n;i++)
#define D(i,j,n) for(int i=j;i>=n;i--)
#define ll long long
#define maxn 20010
using namespace std;
int t,n,cnt,tt,tmp;
struct cir{int x,y,r;}a[maxn];
struct edge_type{int next,to;}e[maxn*2];
struct bor
{
int x,f,id;
friend bool operator < (bor a,bor b)
{
if (a.x==b.x) return a.f<b.f;
return a.x<b.x;
}
}q[maxn*2];
double get_h(int id,int x,int opt)
{
return a[id].y+opt*sqrt(a[id].r*a[id].r-(a[id].x-x)*(a[id].x-x));
}
struct pos
{
int id,opt;
pos(int a=0,int b=0){id=a;opt=b;}
friend bool operator < (pos a,pos b)
{
if (a.id==b.id) return a.opt<b.opt;
return get_h(a.id,tmp,a.opt)<get_h(b.id,tmp,b.opt);
}
};
set<pos> s;
set<pos>::iterator it;
{
int x=0,f=1;char ch=getchar();
while (ch<'0'||ch>'9'){if (ch=='-') f=-1;ch=getchar();}
while (ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
return x*f;
}
{
fa[y]=x;
}
inline ll get(int x)
{
ll ret=0;
return ret+1;
}
int main()
{
while (t--)
{
cnt=tt=0;
memset(fa,0,sizeof(fa));
F(i,1,n)
{
q[++tt]=(bor){a[i].x-a[i].r,1,i};
q[++tt]=(bor){a[i].x+a[i].r,-1,i};
}
sort(q+1,q+tt+1);
F(i,1,tt)
{
if (q[i].f==1)
{
tmp=q[i].x;
it=s.lower_bound(pos(q[i].id,1));
if (it!=s.end())
{
}
s.insert(pos(q[i].id,1));
s.insert(pos(q[i].id,-1));
}
else
{
s.erase(pos(q[i].id,1));
s.erase(pos(q[i].id,-1));
}
}
ll sum=0;
F(i,1,n) if (!fa[i]) sum=sum^get(i);
puts(sum?"Alice":"Bob");
}
}


• 1
点赞
• 0
收藏
觉得还不错? 一键收藏
• 0
评论
09-23
08-19 1919
08-21 546
06-26 1882
10-31 277
09-22
10-03
09-20
08-05 843
07-22 1982
07-27 933
10-13 532
03-30 1045
02-19 209
07-25 363

### “相关推荐”对你有帮助么？

• 非常没帮助
• 没帮助
• 一般
• 有帮助
• 非常有帮助

1.余额是钱包充值的虚拟货币，按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载，可以购买VIP、付费专栏及课程。