QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#321218#5667. Meeting Placesushg8877WA 2ms12284kbC++14959b2024-02-04 10:25:402024-02-04 10:25:40

Judging History

你现在查看的是最新测评结果

  • [2024-02-04 10:25:40]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:12284kb
  • [2024-02-04 10:25:40]
  • 提交

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(j==i||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;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 2ms
memory: 12284kb

input:

100 23 213

output:

1319350480.8

result:

ok found '1319350480.8000000', expected '1319350480.8007326', error '0.0000000'

Test #2:

score: 0
Accepted
time: 0ms
memory: 5920kb

input:

10 1 1060

output:

1042753143.35

result:

ok found '1042753143.3500000', expected '1042753143.3451676', error '0.0000000'

Test #3:

score: 0
Accepted
time: 0ms
memory: 5868kb

input:

10 10 2373

output:

0

result:

ok found '0.0000000', expected '0.0000000', error '-0.0000000'

Test #4:

score: 0
Accepted
time: 0ms
memory: 5800kb

input:

10 2 3396

output:

1236610536.95

result:

ok found '1236610536.9500000', expected '1236610536.9469230', error '0.0000000'

Test #5:

score: 0
Accepted
time: 0ms
memory: 6004kb

input:

10 3 1998

output:

973790809.822

result:

ok found '973790809.8220000', expected '973790809.8224442', error '0.0000000'

Test #6:

score: -100
Wrong Answer
time: 0ms
memory: 5940kb

input:

10 4 562

output:

881977290.333

result:

wrong answer 1st numbers differ - expected: '910867389.9069330', found: '881977290.3329999', error = '0.0317171'