QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#109330 | #5667. Meeting Places | chenshi | WA | 125ms | 8060kb | C++ | 1.1kb | 2023-05-28 14:29:32 | 2023-05-28 14:29:36 |
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=10000,t=1;T--;++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_*t+X[id])/(t+1);y_=(y_*t+Y[id])/(t+1);
}
}
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: 125ms
memory: 8060kb
input:
100 23 213
output:
1319350480.800733
result:
ok found '1319350480.8007331', expected '1319350480.8007326', error '0.0000000'
Test #2:
score: 0
Accepted
time: 11ms
memory: 5844kb
input:
10 1 1060
output:
1042753143.345168
result:
ok found '1042753143.3451680', expected '1042753143.3451676', error '0.0000000'
Test #3:
score: 0
Accepted
time: 11ms
memory: 5736kb
input:
10 10 2373
output:
0.000000
result:
ok found '0.0000000', expected '0.0000000', error '-0.0000000'
Test #4:
score: 0
Accepted
time: 11ms
memory: 5708kb
input:
10 2 3396
output:
1236610536.946923
result:
ok found '1236610536.9469230', expected '1236610536.9469230', error '0.0000000'
Test #5:
score: 0
Accepted
time: 11ms
memory: 7748kb
input:
10 3 1998
output:
973790809.822444
result:
ok found '973790809.8224440', expected '973790809.8224442', error '0.0000000'
Test #6:
score: 0
Accepted
time: 11ms
memory: 5880kb
input:
10 4 562
output:
910867952.154025
result:
ok found '910867952.1540250', expected '910867389.9069330', error '0.0000006'
Test #7:
score: -100
Wrong Answer
time: 7ms
memory: 5688kb
input:
10 5 6048
output:
818241868.379807
result:
wrong answer 1st numbers differ - expected: '818240814.7105150', found: '818241868.3798070', error = '0.0000013'