QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#678943#5667. Meeting PlacesForever_Young#TL 10ms10564kbC++172.0kb2024-10-26 16:29:082024-10-26 16:29:08

Judging History

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

  • [2024-10-26 16:29:08]
  • 评测
  • 测评结果:TL
  • 用时:10ms
  • 内存:10564kb
  • [2024-10-26 16:29:08]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
double R,eps=1e-10;
struct P{double x,y;}a[2005],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[2005];
double dp[2005][2005],pp[2005][2005];
int n,k;

long long x[2005],y[2005];
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;
    if (1ll*n*n*k>=10000000) {
        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);
        }
    } else{
        for (int i=0;i<=n;i++)
            for (int j=0;j<=k;j++) dp[i][j]=1e30;
        dp[0][0]=0;
        for (int i=0;i<n;i++)
            for (int j=i+1;j<=n;j++) pp[i][j]=cal(j-i,dot+i);
        for (int i=0;i<=n;i++)
            for (int j=0;j<=min(i,k);j++)
                for (int l=i+1;l<=n;l++) dp[l][j+1]=min(dp[l][j+1],dp[i][j]+pp[i][l]);
        final_res=dp[n][k];
    }
//     1319350480.8007326126
    printf("%.10f\n",final_res);
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 6ms
memory: 8476kb

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: 6044kb

input:

10 1 1060

output:

1042753143.3451676369

result:

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

Test #3:

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

input:

10 10 2373

output:

0.0

result:

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

Test #4:

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

input:

10 2 3396

output:

1236610536.9469230175

result:

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

Test #5:

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

input:

10 3 1998

output:

973790809.8224442005

result:

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

Test #6:

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

input:

10 4 562

output:

910867389.9069327116

result:

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

Test #7:

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

input:

10 5 6048

output:

818240814.7105149031

result:

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

Test #8:

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

input:

10 6 2524

output:

500106979.3467761874

result:

ok found '500106979.3467762', expected '500106979.3467762', error '0.0000000'

Test #9:

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

input:

10 7 5415

output:

559478971.4320058823

result:

ok found '559478971.4320059', expected '559478971.4320059', error '0.0000000'

Test #10:

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

input:

10 8 1438

output:

500309745.4627699852

result:

ok found '500309745.4627700', expected '500309745.4627700', error '0.0000000'

Test #11:

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

input:

10 9 3172

output:

162279748.8753451705

result:

ok found '162279748.8753452', expected '162279748.8753452', error '0.0000000'

Test #12:

score: 0
Accepted
time: 6ms
memory: 8500kb

input:

100 1 8316

output:

1320052902.1522903442

result:

ok found '1320052902.1522903', expected '1320052902.1522903', error '0.0000000'

Test #13:

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

input:

100 100 4179

output:

0.0

result:

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

Test #14:

score: 0
Accepted
time: 6ms
memory: 10492kb

input:

100 12 3405

output:

1329687126.1304547787

result:

ok found '1329687126.1304548', expected '1329687126.1304548', error '0.0000000'

Test #15:

score: 0
Accepted
time: 6ms
memory: 8496kb

input:

100 16 8378

output:

1338056514.4842693806

result:

ok found '1338056514.4842694', expected '1338056514.4842694', error '0.0000000'

Test #16:

score: 0
Accepted
time: 6ms
memory: 10112kb

input:

100 2 1858

output:

1310392496.1430580616

result:

ok found '1310392496.1430581', expected '1310392496.1430581', error '0.0000000'

Test #17:

score: 0
Accepted
time: 3ms
memory: 10440kb

input:

100 25 4596

output:

1440464106.6229298115

result:

ok found '1440464106.6229298', expected '1440464106.6229298', error '0.0000000'

Test #18:

score: 0
Accepted
time: 9ms
memory: 8260kb

input:

100 3 5633

output:

1399621082.6142737865

result:

ok found '1399621082.6142738', expected '1399621082.6142738', error '0.0000000'

Test #19:

score: 0
Accepted
time: 9ms
memory: 8192kb

input:

100 32 7827

output:

1342073760.5322329998

result:

ok found '1342073760.5322330', expected '1342073760.5322330', error '0.0000000'

Test #20:

score: 0
Accepted
time: 9ms
memory: 8236kb

input:

100 4 3693

output:

1339808706.7098691463

result:

ok found '1339808706.7098691', expected '1339808706.7098689', error '0.0000000'

Test #21:

score: 0
Accepted
time: 6ms
memory: 10408kb

input:

100 5 2252

output:

1394874243.5057041645

result:

ok found '1394874243.5057042', expected '1394874243.5057042', error '0.0000000'

Test #22:

score: 0
Accepted
time: 6ms
memory: 8248kb

input:

100 50 4254

output:

1322809748.4052834511

result:

ok found '1322809748.4052835', expected '1322809748.4052832', error '0.0000000'

Test #23:

score: 0
Accepted
time: 9ms
memory: 10332kb

input:

100 6 53

output:

1364441356.1700985432

result:

ok found '1364441356.1700985', expected '1364441356.1700988', error '0.0000000'

Test #24:

score: 0
Accepted
time: 9ms
memory: 8160kb

input:

100 64 4337

output:

1180754550.2422838211

result:

ok found '1180754550.2422838', expected '1180754550.2422838', error '0.0000000'

Test #25:

score: 0
Accepted
time: 9ms
memory: 10116kb

input:

100 7 5366

output:

1423557626.3586797714

result:

ok found '1423557626.3586798', expected '1423557626.3586798', error '0.0000000'

Test #26:

score: 0
Accepted
time: 9ms
memory: 10456kb

input:

100 8 8509

output:

1353289305.3519952297

result:

ok found '1353289305.3519952', expected '1353289305.3519957', error '0.0000000'

Test #27:

score: 0
Accepted
time: 10ms
memory: 8192kb

input:

100 9 1423

output:

1228887266.5661668777

result:

ok found '1228887266.5661669', expected '1228887266.5661671', error '0.0000000'

Test #28:

score: 0
Accepted
time: 9ms
memory: 10324kb

input:

100 91 4806

output:

656574218.5086754560

result:

ok found '656574218.5086755', expected '656574218.5086756', error '0.0000000'

Test #29:

score: 0
Accepted
time: 6ms
memory: 10452kb

input:

100 92 4024

output:

794693428.6162240505

result:

ok found '794693428.6162241', expected '794693428.6162238', error '0.0000000'

Test #30:

score: 0
Accepted
time: 4ms
memory: 8160kb

input:

100 93 606

output:

677641787.4863121510

result:

ok found '677641787.4863122', expected '677641787.4863122', error '0.0000000'

Test #31:

score: 0
Accepted
time: 6ms
memory: 10564kb

input:

100 94 7265

output:

686423239.2626028061

result:

ok found '686423239.2626028', expected '686423239.2626028', error '0.0000000'

Test #32:

score: 0
Accepted
time: 9ms
memory: 10500kb

input:

100 95 8469

output:

328187125.9235950708

result:

ok found '328187125.9235951', expected '328187125.9235951', error '0.0000000'

Test #33:

score: 0
Accepted
time: 10ms
memory: 10548kb

input:

100 96 1079

output:

492964787.6259085536

result:

ok found '492964787.6259086', expected '492964787.6259086', error '0.0000000'

Test #34:

score: 0
Accepted
time: 7ms
memory: 10528kb

input:

100 97 5453

output:

258652807.7906563878

result:

ok found '258652807.7906564', expected '258652807.7906564', error '0.0000000'

Test #35:

score: 0
Accepted
time: 3ms
memory: 8472kb

input:

100 98 1778

output:

159490192.1188906431

result:

ok found '159490192.1188906', expected '159490192.1188908', error '0.0000000'

Test #36:

score: 0
Accepted
time: 9ms
memory: 10392kb

input:

100 99 1825

output:

33793756.3289980441

result:

ok found '33793756.3289980', expected '33793756.3289980', error '0.0000000'

Test #37:

score: -100
Time Limit Exceeded

input:

1000 1 2453

output:


result: