QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#321216#5667. Meeting Placesushg8877WA 2ms14144kbC++14955b2024-02-04 10:19:382024-02-04 10:19:39

Judging History

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

  • [2024-02-04 10:19:39]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:14144kb
  • [2024-02-04 10:19:38]
  • 提交

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;
}

Details

Tip: Click on the bar to expand more detailed information

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'