第一眼:凸包?不会。。。
第二眼:模拟退火可做。。。
于是开始打
20min后 WOC 20pts+TLE
疯狂调参....
20min后 WOC 40pts+TLE+WA
疯狂调参...
10min后 WOC 还是40...
然后把某人的生日换成了长者的生日
我去80分...NB
正解到时候如果我会的话会发布...但我不会的话可能就不会发布了
1 #pragma GCC optimize(2) 2 #pragma GCC optimize(3) 3 #pragma GCC optimize("inline") 4 #pragma GCC optimize("Ofast") 5 #include<cstdio> 6 #include<iostream> 7 #include<cstring> 8 #include<cmath> 9 #include<algorithm> 10 #include<cstdlib> 11 #include<ctime> 12 #define max(a,b) ((a>b)?(a):(b)) 13 using namespace std; 14 inline int read(){ 15 int ans=0,f=1; char chr=getchar(); 16 while(!isdigit(chr)){if(chr=='-') f=-1;chr=getchar();} 17 while(isdigit(chr)) {ans=(ans<<3)+(ans<<1)+chr-48;chr=getchar();} 18 return ans*f; 19 } 20 int n; 21 double x[50005],y[50005],z[50005],ansx,ansy; 22 double dis(double x,double y,double a,double b){return sqrt((x-a)*(x-a)+(y-b)*(y-b));} 23 double get(double q,double p){ 24 register double ans=0; 25 for(register int i=1;i<=n;++i) 26 ans=max(dis(x[i],y[i],q,p)+z[i],ans) ; 27 return ans; 28 } 29 const double delta=0.9956; 30 double ans=1e20; 31 void Fire(){ 32 register double fx=ansx,fy=ansy; 33 register double t=1217.0; 34 while(t>1e-14){ 35 register double tx=fx+(rand()*2-RAND_MAX)*t; 36 register double ty=fy+(rand()*2-RAND_MAX)*t; 37 register double tans=get(tx,ty); 38 register double DE=-ans+tans; 39 if(DE<0){ 40 fx=tx; 41 fy=ty; 42 ansx=tx; 43 ansy=ty; 44 ans=tans; 45 }else if(exp(-DE/t)*RAND_MAX>rand()) 46 fx=tx,fy=ty; 47 t*=delta; 48 } 49 } 50 int main(){ 51 srand(19260817); 52 n=read(); 53 for(register int i=1;i<=n;++i) 54 scanf("%lf%lf%lf",&x[i],&y[i],&z[i]),ansx+=x[i],ansy+=y[i]; 55 ansx/=1.0*n; 56 ansy/=1.0*n; 57 Fire();Fire();Fire();Fire(); 58 printf("%.2lf %.2lf %.2lf",ansx,ansy,ans); 59 return 0; 60 }