QOJ.ac

QOJ

ID提交记录ID题目HackerOwner结果提交时间测评时间
#764#474629#784. 旋转卡壳ucup-team1004grass8cowSuccess!2024-07-31 21:52:112024-07-31 21:52:13

詳細信息

Extra Test:

Wrong Answer
time: 0ms
memory: 3860kb

input:

6
-18199 -30640
0 0
-60199 600
-59586 -6008
-59058 -11681
-25702 -43271

output:

60201.9900086368

result:

wrong answer 1st numbers differ - expected: '60202.1023304', found: '60201.9900086', error = '0.0000019'

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#474629#784. 旋转卡壳grass8cow#97 71ms11784kbC++17647b2024-07-12 21:13:012024-10-16 12:21:15

answer

#include<bits/stdc++.h>
using namespace std;
int n;
#define ll long long
struct qq{
	ll x,y;
}a[500100];
qq operator - (const qq &a,const qq &b){
	return (qq){a.x-b.x,a.y-b.y};
} 
ll operator * (const qq &a,const qq &b){
	return a.x*b.y-a.y*b.x;
}
ll dis(qq a){
	return a.x*a.x+a.y*a.y;
}
int main(){
	scanf("%lld",&n);
	ll mx=-1;
	for(int i=0;i<n;i++)
	scanf("%lld%lld",&a[i].x,&a[i].y);
	int j=-1;
	for(int i=0;i<n;i++)if(mx<dis(a[0]-a[i]))
	mx=dis(a[0]-a[i]),j=i;
	for(int i=0;i<n;i++){
		while(dis(a[(j+1)%n]-a[i])>dis(a[j]-a[i]))j=(j+1)%n;
		mx=max(mx,dis(a[j]-a[i]));
	}
	printf("%.10lf",sqrt(mx));
	return 0;
}