2020年河南省CCPC大学生程序设计竞赛
http://acm.zzuli.edu.cn/problem.php?id=2692
#include<iostream>
#include<map>
#include<vector>
using namespace std;
typedef long long LL;
const int N = 2010;
struct node
{
LL x,y,h;int ff=0;
}a[N];
struct note
{
LL x,y,atk,r;int ff=0;
}b[N];
vector<pair<int,int>>q;
int main()
{
int n;cin>>n;
int aa=0,bb=0;
for(int i=0;i<n;i++)
{
int op;cin>>op;
if(op==1)
{
q.push_back({
1,aa});
cin>>a[aa].x>>a[aa].y>>a[aa].h;
aa++;
}
else
{
q.push_back({
2,bb});
cin>>b[bb].x>>b[bb].y>>b[bb].atk>>b[bb].r;
long long ans=1e18;
int xx,yy;
for(int j=0;j<aa;j++)
{
if(a[j].ff) continue;
if( (b[bb].x-a[j].x)*(b[bb].x-a[j].x) + (b[bb].y-a[j].y)*(b[bb].y-a[j].y) < ans )
{
xx=a[j].x;
yy=a[j].y;
ans = (b[bb].x-a[j].x)*(b[bb].x-a[j].x) + (b[bb].y-a[j].y)*(b[bb].y-a[j].y) ;
}
}
if(ans==1e18)
{
bb++;
continue;
}
for(int j=0;j<aa;j++)
{
if(a[j].ff) continue;
if( (xx-a[j].x)*(xx-a[j].x) + (yy-a[j].y)*(yy-a[j].y) <= b[bb].r * b[bb].r )
{
a[j].h-=b[bb].atk*3;
if(a[j].h<=0)
{
a[j].h=0;
a[j].ff=1;
}
else
{
b[bb].ff=1;
}
}
}
bb++;
}
}
for(int i=0;i<n;i++)
{
if(q[i].first==1)
{
if(a[ q[i].second ].ff == 1 )
puts("No");
else puts("Yes");
}
else
{
if(b[ q[i].second ].ff == 1 )
puts("No");
else puts("Yes");
}
}
return 0;
}