QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#125342#142. 平面最近点对NOI_AK_ME#0 3ms3984kbC++23673b2023-07-16 16:05:172023-07-16 16:05:20

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-07-16 16:05:20]
  • 评测
  • 测评结果:0
  • 用时:3ms
  • 内存:3984kb
  • [2023-07-16 16:05:17]
  • 提交

answer

#include<bits/stdc++.h>
#define double long double
using namespace std;
const int N=4e5+5;
struct node{
	double a[4];
	bool operator <(const node &t) const{
		return a[0]*a[1]<t.a[0]*t.a[1];
	}
}p[N];
double z,w,ans,x,y,x_,y_;
int n;
int main(){
	scanf("%d",&n);
	int k=min(n,100);
	z=sin(1),w=cos(1);
	for(int i=1;i<=n;i++){
		scanf("%Lf%Lf",&x,&y);
		p[i]=node({x*w-y*z,x*z+y*w,x,y});
	}
	stable_sort(p+1,p+n+1);
	ans=2e30+0.01;
	for(int i=1;i<=n;i++)
		for(int j=1;j<=k&&i+j<=n;j++){
			x=p[i].a[2],y=p[i].a[3];
			x_=p[i+j].a[2],y_=p[i+j].a[3];
			z=(x-x_)*(x-x_)+(y-y_)*(y-y_);
			ans=min(ans,z);
		}
	printf("%.0Lf",ans);
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 3ms
memory: 3984kb

input:

2933
19320 28055
2053 27470
14635 1378
27582 9822
28729 107
22351 3093
17670 379
23901 4686
27182 12261
19443 8467
24208 20283
10763 10584
25953 28380
28290 27394
19572 14769
4024 12401
23295 3267
26949 176
13416 4517
23856 15413
26260 18957
18275 24409
999 3873
28202 14686
25446 2822
24009 8949
114...

output:

8

result:

wrong answer 1st numbers differ - expected: '2.8284271', found: '8.0000000', error = '1.8284271'

Subtask #2:

score: 0
Skipped

Dependency #1:

0%

Subtask #3:

score: 0
Skipped

Dependency #1:

0%

Subtask #4:

score: 0
Skipped

Dependency #1:

0%

Subtask #5:

score: 0
Skipped

Dependency #1:

0%