QOJ.ac
QOJ
ID | Submission ID | Problem | Hacker | Owner | Result | Submit time | Judge time |
---|---|---|---|---|---|---|---|
#764 | #474629 | #784. 旋转卡壳 | ucup-team1004 | grass8cow | Success! | 2024-07-31 21:52:11 | 2024-07-31 21:52:13 |
Details
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 | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#474629 | #784. 旋转卡壳 | grass8cow# | 97 | 71ms | 11784kb | C++17 | 647b | 2024-07-12 21:13:01 | 2024-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;
}