rt
样例输出 0
没事交一发然后A啦?
为啥啊
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int N=1e3+5;
int n,m,R;
struct point { // Ô²£¬µã¿ÉÊÓΪ r=0
double x, y, r;
} a[N], b[N];
double dis(double fx, double fy, double gx, double gy) { // ¼ÆËãÁ½µã¾àÀë
return sqrt((fx - gx) * (fx - gx) + (fy - gy) * (fy - gy));
}
double f(double x,double y)
{
double d = R, ret = 0;
for (int i = 1; i <= n; i++)
d = min(d, dis(x,y,a[i].x, a[i].y)-a[i].r);
for (int i = 1; i <= m; i++)
if (dis(b[i].x, b[i].y, x, y)<=d) ret++;
return ret;
}
#define deltaT 0.9976
#define StT 20060
#define Eps 1e-18
double ansx,ansy,ans;
void SimulateAnneal()
{
for (double T = StT, nowx, nowy; T > Eps; T *= deltaT)
{
nowx = ansx + (rand() * 2 - RAND_MAX) * T,
nowy = ansy + (rand() * 2 - RAND_MAX) * T;
// Ëæ»úÊýΪÕýÕûÊý£¬ÕâÀïÕâÑù²Ù×÷±£Ö¤±ä»¯Á¿¿ÉÒÔΪ¸ºÊý¡£
double delta = f(nowx, nowy) - ans;
if ((delta > 0) || (exp(-delta / T) * RAND_MAX < rand()))
ansx = nowx, ansy = nowy, ans = ans + delta;
}
}
void SAwork()
{
while((double)clock()/CLOCKS_PER_SEC<=0.85) SimulateAnneal();
return ;
}
signed main()
{
srand(114514);
cin>>n>>m>>R;
for(int i=1,x,y,r;i<=n;++i)
{
cin>>x>>y>>r;
a[i].x=x,a[i].y=y,a[i].r=r;
}
for(int i=1,x,y;i<=m;++i)
{
cin>>x>>y;
b[i].x=x,b[i].y=y,b[i].r=0;
ansx+=x;ansy+=y;
}
ansx/=m,ansy/=m;
ans=f(ansx,ansy);
SAwork();
cout<<(int)ans<<endl;
return 0;
}