RP最好的一次80分。。。求dalao调参QwQ
#include<iostream>
#include<cstdlib>
#include<cmath>
#include<ctime>
typedef double db;
const db delta=0.99;
db t,x,y;
struct Node{int x,y,r;}a[15],w[1005];
int n,m,k,r,ans;
inline db DIS(db x,db y,db a,db b){return sqrt(pow(x-a,2)+pow(y-b,2));}
template<typename Tp>inline Tp min(const Tp x,const Tp y){return x>y?y:x;}
int calc_energy(db x,db y)
{
int i,ans=0;db Dis=1e18;
for(i=1;i<=n;++i)
{
db dis=DIS(a[i].x,a[i].y,x,y)-a[i].r;
if(dis<0)return 0;
Dis=min(Dis,dis);
}
Dis=min(db(r),Dis);
for(i=1;i<=m;++i)if(DIS(w[i].x,w[i].y,x,y)<Dis)++ans;
return ans;
}
void simulate_anneal()
{
for(t=2000;t>1e-14;t*=delta)
{
db X=x+((rand()<<1)-RAND_MAX)*t,Y=y+((rand()<<1)-RAND_MAX)*t;
db now=calc_energy(X,Y);db Delta=ans-now;
if(Delta<0||exp(-Delta/t)>rand())x=X,y=Y,ans=now;
}
}
void Solve()
{
srand(time(NULL));srand(rand());
x/=n;y/=n;
simulate_anneal();
simulate_anneal();
simulate_anneal();
simulate_anneal();
simulate_anneal();
}
signed main(void)
{
int i;
std::cin>>n>>m>>r;
for(i=1;i<=n;++i)
{
std::cin>>a[i].x>>a[i].y>>a[i].r;
x+=a[i].x;y+=a[i].y;
}
for(i=1;i<=m;++i)std::cin>>w[i].x>>w[i].y;
Solve();
std::cout<<ans;
}