QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#321214 | #5667. Meeting Places | ushg8877 | WA | 2ms | 10332kb | C++14 | 952b | 2024-02-04 10:18:39 | 2024-02-04 10:18: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=0;
for(int i=1;i<=k;i++) ans=min(ans,f[n][i]);
cout<<setprecision(12)<<ans/2<<endl;
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 2ms
memory: 10332kb
input:
100 23 213
output:
0
result:
wrong answer 1st numbers differ - expected: '1319350480.8007326', found: '0.0000000', error = '1.0000000'