QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#109333#5667. Meeting PlaceschenshiWA 380ms8144kbC++2.0kb2023-05-28 14:36:402023-05-28 14:36:42

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:36:42]
  • 评测
  • 测评结果:WA
  • 用时:380ms
  • 内存:8144kb
  • [2023-05-28 14:36:40]
  • 提交

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;
inline pair<double,double> calc2(double X1,double Y1,double X2,double Y2){
	double k=(X2-X1)/(Y1-Y2),x=(X1+Y1)/2,y=(X2+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) 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 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));
	}
	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;
}

详细

Test #1:

score: 100
Accepted
time: 377ms
memory: 7748kb

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: 7732kb

input:

10 1 1060

output:

1042753143.345168

result:

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

Test #3:

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

input:

10 10 2373

output:

0.000000

result:

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

Test #4:

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

input:

10 2 3396

output:

1236610536.946923

result:

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

Test #5:

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

input:

10 3 1998

output:

973790809.822444

result:

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

Test #6:

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

input:

10 4 562

output:

910867471.448691

result:

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

Test #7:

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

input:

10 5 6048

output:

818240911.381159

result:

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

Test #8:

score: 0
Accepted
time: 29ms
memory: 7940kb

input:

10 6 2524

output:

500107027.200254

result:

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

Test #9:

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

input:

10 7 5415

output:

559478971.855291

result:

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

Test #10:

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

input:

10 8 1438

output:

500309745.951091

result:

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

Test #11:

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

input:

10 9 3172

output:

162279748.875345

result:

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

Test #12:

score: 0
Accepted
time: 380ms
memory: 7680kb

input:

100 1 8316

output:

1320052902.152290

result:

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

Test #13:

score: 0
Accepted
time: 376ms
memory: 8144kb

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: 379ms
memory: 8016kb

input:

100 12 3405

output:

1317216606.482693

result:

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