QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#678886#5667. Meeting PlacesForever_Young#WA 1ms10072kbC++171.5kb2024-10-26 16:21:492024-10-26 16:21:50

Judging History

你现在查看的是最新测评结果

  • [2024-10-26 16:21:50]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:10072kb
  • [2024-10-26 16:21:49]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
double R,eps=1e-10;
struct P{double x,y;}a[200005],O;
double dis(P x,P y){return sqrt((x.x-y.x)*(x.x-y.x)+(x.y-y.y)*(x.y-y.y));}
P center(P x,P y,P z)
{
    double a1=y.x-x.x,b1=y.y-x.y,
            c1=(a1*a1+b1*b1)/2,a2=z.x-x.x,
            b2=z.y-x.y,c2=(a2*a2+b2*b2)/2,
            d=a1*b2-a2*b1;
    return (P){x.x+(c1*b2-c2*b1)/d,x.y+(a1*c2-a2*c1)/d};
}
double cal(int n,P *b){
    int i,j,k;
    for(i=0;i<n;i++)a[i]=b[i];
    for(i=0;i<n;i++)swap(a[rand()%n],a[i]);
    for(O=a[0],R=0,i=1;i<n;i++)if(dis(a[i],O)>R+eps)
            for(O=a[i],R=0,j=0;j<i;++j)if(dis(a[j],O)>R+eps){
                    O=(P){(a[i].x+a[j].x)/2,(a[i].y+a[j].y)/2},R=dis(O,a[i]);
                    for(k=0;k<j;k++)if(dis(a[k],O)>R+eps)O=center(a[k],a[j],a[i]),R=dis(O,a[i]);
                }
    return R;
}
P dot[200005];
int n,k;

long long x[200005],y[200005];
long long nxt(long long x){
    return (x*233811181ll+1)%((1ll<<31)-1);
}

int main(){
    srand(time(0));
    scanf("%d%d%lld",&n,&k,&x[1]);
    if (k>=n){
        printf("0.0\n");
        return 0;
    }
    y[1]=nxt(x[1]);
    for (int i=2;i<=n;i++) {
        x[i] = nxt(y[i - 1]);
        y[i] = nxt(x[i]);
    }
    for (int i=0;i<n;i++) dot[i]={x[i+1],y[i+1]};

    double final_res=1e30;
    for (int i=0;i+n-k+1-1<n;i++){
        double r = cal(n-k+1,dot+i);
        final_res=min(r,final_res);
    }
//     1319350480.8007326126
    printf("%.10f\n",final_res);
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 10060kb

input:

100 23 213

output:

1319350480.8007326126

result:

ok found '1319350480.8007326', expected '1319350480.8007326', error '0.0000000'

Test #2:

score: 0
Accepted
time: 1ms
memory: 7960kb

input:

10 1 1060

output:

1042753143.3451676369

result:

ok found '1042753143.3451676', expected '1042753143.3451676', error '0.0000000'

Test #3:

score: 0
Accepted
time: 1ms
memory: 5904kb

input:

10 10 2373

output:

0.0

result:

ok found '0.0000000', expected '0.0000000', error '-0.0000000'

Test #4:

score: 0
Accepted
time: 0ms
memory: 10004kb

input:

10 2 3396

output:

1236610536.9469230175

result:

ok found '1236610536.9469230', expected '1236610536.9469230', error '0.0000000'

Test #5:

score: 0
Accepted
time: 1ms
memory: 10072kb

input:

10 3 1998

output:

973790809.8224442005

result:

ok found '973790809.8224442', expected '973790809.8224442', error '0.0000000'

Test #6:

score: 0
Accepted
time: 1ms
memory: 8032kb

input:

10 4 562

output:

910867389.9069329500

result:

ok found '910867389.9069330', expected '910867389.9069330', error '0.0000000'

Test #7:

score: 0
Accepted
time: 1ms
memory: 8036kb

input:

10 5 6048

output:

818240814.7105149031

result:

ok found '818240814.7105149', expected '818240814.7105150', error '0.0000000'

Test #8:

score: -100
Wrong Answer
time: 1ms
memory: 8064kb

input:

10 6 2524

output:

674787674.3129854202

result:

wrong answer 1st numbers differ - expected: '500106979.3467762', found: '674787674.3129854', error = '0.3492867'