QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#321216 | #5667. Meeting Places | ushg8877 | WA | 2ms | 14144kb | C++14 | 955b | 2024-02-04 10:19:38 | 2024-02-04 10:19:39 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define MP make_pair
const int MAXN=2005;
ll x[MAXN],y[MAXN],n,k;
long double a[MAXN][MAXN],f[MAXN][MAXN];
int main(){
ios::sync_with_stdio(false);
cin>>n>>k>>x[1];
y[1]=(233811181*x[1]+1)%((1ll<<31)-1);
for(int i=2;i<=n;i++){
x[i]=(233811181*y[i-1]+1)%((1ll<<31)-1);
y[i]=(233811181*x[i]+1)%((1ll<<31)-1);
}
for(int i=1;i<=n;i++) for(int j=i;j<=n;j++)
a[i][j]=sqrt((x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j]));
for(int l=n;l>=1;l--) for(int r=l+1;r<=n;r++)
a[l][r]=max({a[l][r],a[l+1][r],a[l][r-1]});
for(int i=0;i<=n;i++) for(int j=0;j<=k;j++) f[i][j]=1e18;
f[0][0]=0;
for(int i=1;i<=n;i++){
for(int j=i;j>=1;j--) if(a[j][i]!=a[j-1][i]){
for(int t=1;t<=k;t++) f[i][t]=min(f[i][t],f[j-1][t-1]+a[j][i]);
}
}
long double ans=1e18;
for(int i=1;i<=k;i++) ans=min(ans,f[n][i]);
cout<<setprecision(12)<<ans/2<<endl;
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 2ms
memory: 14144kb
input:
100 23 213
output:
1319350480.8
result:
ok found '1319350480.8000000', expected '1319350480.8007326', error '0.0000000'
Test #2:
score: 0
Accepted
time: 1ms
memory: 6020kb
input:
10 1 1060
output:
1042753143.35
result:
ok found '1042753143.3500000', expected '1042753143.3451676', error '0.0000000'
Test #3:
score: -100
Wrong Answer
time: 1ms
memory: 5896kb
input:
10 10 2373
output:
510280442.667
result:
wrong answer 1st numbers differ - expected: '0.0000000', found: '510280442.6670000', error = '510280442.6670000'