QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#109319 | #5667. Meeting Places | chenshi# | WA | 72ms | 4204kb | C++ | 1.1kb | 2023-05-28 13:43:01 | 2023-05-28 13:43:05 |
Judging History
answer
#include<cstdio>
#include<cmath>
#include<iostream>
using namespace std;
const int o=2010,v1=233811181,v2=(1ll<<31)-1;const double inf=1e18;
int n,K,X[o],Y[o];double f[o][o],c[o][o],x_,y_,mx,v;
int main(){
scanf("%d%d%d",&n,&K,&X[1]);
for(int i=1;i<=n;++i){
if(i>1) X[i]=(Y[i-1]*1ll*v1+1)%v2;
Y[i]=(X[i]*1ll*v1+1)%v2;f[0][i]=inf;
}
for(int i=1;i<=n;++i) for(int j=i;j<=n;++j) c[i][j]=sqrt((X[i]-X[j])*1ll*(X[i]-X[j])+(Y[i]-Y[j])*1ll*(Y[i]-Y[j]))/2;
for(int i=n;i;--i) for(int j=i;j<=n;++j) c[i][j]=max(c[i][j],c[i+1][j]);
for(int i=1;i<=n;++i) for(int j=i;j<=n;++j) c[i][j]=max(c[i][j],c[i][j-1]);
for(int i=1;i<=n;++i) for(int j=i,id;j<=n&&j<i+7;++j){
c[i][j]=inf;
if(j==i) x_=X[i],y_=Y[i];
for(int T=7500;T--;){
id=j;mx=0;
for(int k=i;k<=j;++k) if((v=(x_-X[k])*1ll*(x_-X[k])+(y_-Y[k])*1ll*(y_-Y[k]))>mx) mx=v,id=k;
c[i][j]=min(c[i][j],sqrt(mx));x_=(x_*10000+X[id])/10001;y_=(y_*10000+Y[id])/10001;
}
}
for(int i=1;i<=K;++i) for(int j=1;j<=n;++j){
f[i][j]=inf;
for(int k=j,lim=n/K*50;k&&k>j-lim;--k) f[i][j]=min(f[i][j],f[i-1][k-1]+c[k][j]);
}
printf("%lf",f[K][n]);
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 72ms
memory: 4204kb
input:
100 23 213
output:
1319350480.800733
result:
ok found '1319350480.8007331', expected '1319350480.8007326', error '0.0000000'
Test #2:
score: 0
Accepted
time: 5ms
memory: 3604kb
input:
10 1 1060
output:
1042753143.345168
result:
ok found '1042753143.3451680', expected '1042753143.3451676', error '0.0000000'
Test #3:
score: 0
Accepted
time: 7ms
memory: 3664kb
input:
10 10 2373
output:
0.000000
result:
ok found '0.0000000', expected '0.0000000', error '-0.0000000'
Test #4:
score: 0
Accepted
time: 7ms
memory: 3812kb
input:
10 2 3396
output:
1236610536.946923
result:
ok found '1236610536.9469230', expected '1236610536.9469230', error '0.0000000'
Test #5:
score: 0
Accepted
time: 7ms
memory: 3680kb
input:
10 3 1998
output:
973790809.822444
result:
ok found '973790809.8224440', expected '973790809.8224442', error '0.0000000'
Test #6:
score: 0
Accepted
time: 7ms
memory: 3880kb
input:
10 4 562
output:
910867677.245428
result:
ok found '910867677.2454280', expected '910867389.9069330', error '0.0000003'
Test #7:
score: 0
Accepted
time: 4ms
memory: 3888kb
input:
10 5 6048
output:
818241509.774690
result:
ok found '818241509.7746900', expected '818240814.7105150', error '0.0000008'
Test #8:
score: -100
Wrong Answer
time: 7ms
memory: 3828kb
input:
10 6 2524
output:
506138397.051622
result:
wrong answer 1st numbers differ - expected: '500106979.3467762', found: '506138397.0516220', error = '0.0120603'