QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#109338#5667. Meeting PlaceschenshiWA 7ms4668kbC++1.6kb2023-05-28 15:34:572023-05-28 15:34:59

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 15:34:59]
  • 评测
  • 测评结果:WA
  • 用时:7ms
  • 内存:4668kb
  • [2023-05-28 15:34:57]
  • 提交

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];
inline pair<double,double> calc2(double X1,double Y1,double X2,double Y2){
	double k=(X2-X1)/(Y1-Y2),x=(X1+X2)/2,y=(Y1+Y2)/2;
	return make_pair(k,y-k*x);
}
inline pair<double,double> calc1(pair<double,double> l1,pair<double,double> l2){
	double x=(l1.second-l2.second)/(l2.first-l1.first);
	return make_pair(x,x*l1.first+l1.second);
}
inline double calc(pair<double,double> pr,int l,int r){
	double res=0;
	for(int i=l;i<=r;++i) res=max(res,sqrt((pr.first-X[i])*(pr.first-X[i])+(pr.second-Y[i])*(pr.second-Y[i])));
	return res;
}
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){
		if(j-i<9){
			c[i][j]=inf;
			for(int k=i;k<=j;++k) for(int $=k;$<=j;++$)
				c[i][j]=min(c[i][j],calc(make_pair((X[k]+0ll+X[$])/2,(Y[k]+0ll+Y[$])/2),i,j));
			for(int k=i;k<=j;++k) for(int $=i;$<=j;++$) for(int _=i;_<=j;++_) if($-k&&_-k&&$-_)
				c[i][j]=min(c[i][j],calc(calc1(calc2(X[k],Y[k],X[$],Y[$]),calc2(X[k],Y[k],X[_],Y[_])),i,j));
			continue;
		}
		c[i][j]=c[i][j-1];
		for(int k=i;k<=j;++k) c[i][j]=max(c[i][j],sqrt((X[k]-X[j])*1ll*(X[k]-X[j])+(Y[k]-Y[j])*1ll*(Y[k]-Y[j]))/2);
	}
	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*100;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: 5ms
memory: 4340kb

input:

100 23 213

output:

1319350480.800733

result:

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

Test #2:

score: 0
Accepted
time: 2ms
memory: 3760kb

input:

10 1 1060

output:

1042753143.397963

result:

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

Test #3:

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

input:

10 10 2373

output:

0.000000

result:

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

Test #4:

score: 0
Accepted
time: 2ms
memory: 3612kb

input:

10 2 3396

output:

1236610537.265838

result:

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

Test #5:

score: 0
Accepted
time: 2ms
memory: 3676kb

input:

10 3 1998

output:

973790809.822444

result:

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

Test #6:

score: 0
Accepted
time: 2ms
memory: 3628kb

input:

10 4 562

output:

910867389.906933

result:

ok found '910867389.9069330', expected '910867389.9069330', error '0.0000000'

Test #7:

score: 0
Accepted
time: 2ms
memory: 3804kb

input:

10 5 6048

output:

818240814.710515

result:

ok found '818240814.7105150', expected '818240814.7105150', error '0.0000000'

Test #8:

score: 0
Accepted
time: 2ms
memory: 3668kb

input:

10 6 2524

output:

500106979.417769

result:

ok found '500106979.4177690', expected '500106979.3467762', error '0.0000000'

Test #9:

score: 0
Accepted
time: 2ms
memory: 3676kb

input:

10 7 5415

output:

559478972.261266

result:

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

Test #10:

score: 0
Accepted
time: 2ms
memory: 3680kb

input:

10 8 1438

output:

500309745.951091

result:

ok found '500309745.9510910', expected '500309745.4627700', error '0.0000000'

Test #11:

score: 0
Accepted
time: 2ms
memory: 3892kb

input:

10 9 3172

output:

162279749.358635

result:

ok found '162279749.3586350', expected '162279748.8753452', error '0.0000000'

Test #12:

score: 0
Accepted
time: 5ms
memory: 4244kb

input:

100 1 8316

output:

1320052902.152290

result:

ok found '1320052902.1522901', expected '1320052902.1522903', error '0.0000000'

Test #13:

score: 0
Accepted
time: 7ms
memory: 4668kb

input:

100 100 4179

output:

0.000000

result:

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

Test #14:

score: -100
Wrong Answer
time: 6ms
memory: 4148kb

input:

100 12 3405

output:

1317216606.482693

result:

wrong answer 1st numbers differ - expected: '1329687126.1304548', found: '1317216606.4826930', error = '0.0093785'