QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#184463 | #5667. Meeting Places | ucup-team1508# | WA | 1ms | 10744kb | C++14 | 1.1kb | 2023-09-20 19:40:47 | 2023-09-20 19:40:49 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const int N=2010;
typedef long long ll;
typedef double db;
const int P=(1ll<<31)-1;
const db inf=1e100;
ll sqr(int x) { return 1ll*x*x; }
db dis(int x1,int y1,int x2,int y2) { return sqrtl(sqr(x2-x1)+sqr(y2-y1)); }
int f(int x) { return (1ll*x*233811181+1)%P; }
int n,k;
int x[N],y[N];
ll d[N][N];
ll calc[N][N];
db dp[N][N];
int main()
{
scanf("%d%d%d",&n,&k,&x[1]);
y[1]=f(x[1]);
for(int i=2;i<=n;i++) x[i]=f(y[i-1]),y[i]=f(x[i]);
for(int i=1;i<=n;i++) for(int j=i+1;j<=n;j++) d[i][j]=d[j][i]=sqr(x[i]-x[j])+sqr(y[i]-y[j]);
for(int len=1;len<=n;len++) for(int l=1;l+len-1<=n;l++)
{
int r=l+len-1;
calc[l][r]=max(max(calc[l][r-1],calc[l+1][r]),d[l][r]);
// cerr<<l<<" "<<r<<" "<<calc[l][r]<<"\n";
}
for(int i=0;i<=n;i++) for(int j=0;j<=k;j++) dp[i][j]=inf;
dp[0][0]=0;
for(int i=1;i<=n;i++)
{
for(int j=i;j;j--) if(calc[j][i]!=calc[j-1][i])
{
for(int l=1;l<=k;l++) dp[i][l]=min(dp[i][l],dp[j-1][l-1]+sqrt(calc[j][i]));
}
}
printf("%.20lf\n",dp[n][k]/2);
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 10744kb
input:
100 23 213
output:
1319350480.80073261260986328125
result:
ok found '1319350480.8007326', expected '1319350480.8007326', error '0.0000000'
Test #2:
score: 0
Accepted
time: 1ms
memory: 6000kb
input:
10 1 1060
output:
1042753143.34516763687133789062
result:
ok found '1042753143.3451676', expected '1042753143.3451676', error '0.0000000'
Test #3:
score: -100
Wrong Answer
time: 1ms
memory: 6060kb
input:
10 10 2373
output:
5000000000000000079514455548799590234180404281972640694890663778873919386085190530406734992928407552.00000000000000000000
result:
wrong answer 1st numbers differ - expected: '0.0000000', found: '5000000000000000079514455548799590234180404281972640694890663778873919386085190530406734992928407552.0000000', error = '5000000000000000079514455548799590234180404281972640694890663778873919386085190530406734992928407552.0000000'