QOJ.ac

QOJ

IDSubmission IDProblemHackerOwnerResultSubmit timeJudge time
#762#499959#784. 旋转卡壳ucup-team1004ucup-team1004Failed.2024-07-31 21:41:222024-07-31 21:41:24

Details

Extra Test:

Accepted
time: 0ms
memory: 3936kb

input:

6
-181112897 -304914878
0 0
-601999999 6000000
-596288061 -55469227
-590587180 -116819442
-257022646 -432713682

output:

602029898.589762688

result:

ok found '602029898.5897627', expected '602029898.9332205', error '0.0000000'

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#499959#784. 旋转卡壳ucup-team100497 71ms7844kbC++141.0kb2024-07-31 20:30:432024-07-31 21:49:25

answer

#include<bits/stdc++.h>
using namespace std;
#ifdef DEBUG
#include"debug.h"
#else
#define debug(...) void()
#endif
#define all(x) (x).begin(),(x).end()
template<class T>
auto ary(T *a,int l,int r){
	return vector<T>{a+l,a+1+r};
}
using ll=long long;
using ull=unsigned long long;
using vec=complex<int>;
const int N=5e5+10;
int n;
vec a[N];
ll dot(const vec &a,const vec &b){
	return 1ll*real(a)*real(b)+1ll*imag(a)*imag(b);
}
ll cross(const vec &a,const vec &b){
	return dot(a,b*vec(0,-1));
}
ll dis2(const vec &a){
	return dot(a,a);
}
double dis(const vec &a){
	return sqrt(dis2(a));
}
int main(){
	scanf("%d",&n);
	for(int i=1,x,y;i<=n;i++){
		scanf("%d%d",&x,&y),a[i]=vec(x,y);
	}
	ll ans=0;
	int j=1;
	for(int i=2;i<=n;i++){
		if(dis2(a[i]-a[1])>ans){
			ans=dis2(a[i]-a[1]),j=i;
		}
	}
	for(int i=1;i<=n;i++){
		for(;dis2(a[i]-a[j])<dis2(a[i]-a[j%n+1]);j=j%n+1);
		ans=max(ans,dis2(a[i]-a[j]));
	}
	printf("%.9lf\n",sqrt(ans));
	return 0;
}
#ifdef DEBUG
#include"debug.hpp"
#endif