QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#109332#5667. Meeting PlaceschenshiWA 372ms8056kbC++1.1kb2023-05-28 14:34:452023-05-28 14:34:48

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-05-28 14:34:48]
  • 评测
  • 测评结果:WA
  • 用时:372ms
  • 内存:8056kb
  • [2023-05-28 14:34:45]
  • 提交

answer

#include<cstdio>
#include<cmath>
#include<iostream>
using namespace std;
const int o=2010,v1=233811181,v2=(1ll<<31)-1;const double inf=1e18;
int n,K,X[o],Y[o];double f[o][o],c[o][o],x_,y_,mx,v;
int main(){
	scanf("%d%d%d",&n,&K,&X[1]);
	for(int i=1;i<=n;++i){
		if(i>1) X[i]=(Y[i-1]*1ll*v1+1)%v2;
		Y[i]=(X[i]*1ll*v1+1)%v2;f[0][i]=inf;
	}
	for(int i=1;i<=n;++i) for(int j=i;j<=n;++j) c[i][j]=sqrt((X[i]-X[j])*1ll*(X[i]-X[j])+(Y[i]-Y[j])*1ll*(Y[i]-Y[j]))/2;
	for(int i=n;i;--i) for(int j=i;j<=n;++j) c[i][j]=max(c[i][j],c[i+1][j]);
	for(int i=1;i<=n;++i) for(int j=i;j<=n;++j) c[i][j]=max(c[i][j],c[i][j-1]);
	for(int i=1;i<=n;++i) for(int j=i,id;j<=n&&j<i+7;++j){
		c[i][j]=inf;
		if(j==i) x_=X[i],y_=Y[i];
		for(int T=30000,t=1;T--;++t){
			id=j;mx=0;
			for(int k=i;k<=j;++k) if((v=(x_-X[k])*1ll*(x_-X[k])+(y_-Y[k])*1ll*(y_-Y[k]))>mx) mx=v,id=k;
			c[i][j]=min(c[i][j],sqrt(mx));x_=(x_*t+X[id])/(t+1);y_=(y_*t+Y[id])/(t+1);
		}
	}
	for(int i=1;i<=K;++i) for(int j=1;j<=n;++j){
		f[i][j]=inf;
		for(int k=j,lim=n/K*50;k&&k>j-lim;--k) f[i][j]=min(f[i][j],f[i-1][k-1]+c[k][j]);
	}
	printf("%lf",f[K][n]);
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 372ms
memory: 8056kb

input:

100 23 213

output:

1319350480.800733

result:

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

Test #2:

score: 0
Accepted
time: 28ms
memory: 5704kb

input:

10 1 1060

output:

1042753143.345168

result:

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

Test #3:

score: 0
Accepted
time: 24ms
memory: 5832kb

input:

10 10 2373

output:

0.000000

result:

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

Test #4:

score: 0
Accepted
time: 21ms
memory: 7920kb

input:

10 2 3396

output:

1236610536.946923

result:

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

Test #5:

score: 0
Accepted
time: 28ms
memory: 5832kb

input:

10 3 1998

output:

973790809.822444

result:

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

Test #6:

score: 0
Accepted
time: 23ms
memory: 5840kb

input:

10 4 562

output:

910867471.448691

result:

ok found '910867471.4486910', expected '910867389.9069330', error '0.0000001'

Test #7:

score: 0
Accepted
time: 28ms
memory: 5688kb

input:

10 5 6048

output:

818240911.381159

result:

ok found '818240911.3811589', expected '818240814.7105150', error '0.0000001'

Test #8:

score: 0
Accepted
time: 24ms
memory: 5736kb

input:

10 6 2524

output:

500107027.200254

result:

ok found '500107027.2002540', expected '500106979.3467762', error '0.0000001'

Test #9:

score: 0
Accepted
time: 26ms
memory: 5888kb

input:

10 7 5415

output:

559478971.855291

result:

ok found '559478971.8552910', expected '559478971.4320059', error '0.0000000'

Test #10:

score: -100
Wrong Answer
time: 24ms
memory: 5900kb

input:

10 8 1438

output:

500315181.054139

result:

wrong answer 1st numbers differ - expected: '500309745.4627700', found: '500315181.0541390', error = '0.0000109'