QOJ.ac

QOJ

ID提交记录ID题目HackerOwner结果提交时间测评时间
#763#499959#784. 旋转卡壳ucup-team1004ucup-team1004Success!2024-07-31 21:47:312024-07-31 21:47:32

詳細信息

Extra Test:

Wrong Answer
time: 0ms
memory: 3916kb

input:

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

output:

60201.990008637

result:

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

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#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