QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#586616 | #784. 旋转卡壳 | houbur | 0 | 1ms | 6372kb | C++20 | 1.4kb | 2024-09-24 14:40:16 | 2024-09-24 14:40:16 |
Judging History
你现在查看的是最新测评结果
- [2024-10-16 12:18:36]
- hack成功,自动添加数据
- (/hack/1005)
- [2024-09-24 16:55:39]
- hack成功,自动添加数据
- (/hack/888)
- [2024-09-24 14:40:16]
- 提交
answer
#include<iostream>
#include<cmath>
#include<algorithm>
using namespace std;
const int N=5e5+5;
int n,m,top,xx,yy;
struct sb{
double x,y,k;
}e[N],st[N];
inline bool cmp(sb a,sb b){return (a.y==b.y)?(a.x<b.x):(a.y<b.y);}
inline double cross(sb a,sb b,sb c){return (b.x-a.x)*(c.y-a.y)-(c.x-a.x)*(b.y-a.y);}
inline double ddd(sb a,sb b){return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y));}
inline double dis(sb a,sb b,sb c){
double k=(b.y-c.y)/(b.x-c.x);
double bb=b.y-k*b.x;
return fabs(k*a.x-a.y+bb)/sqrt(k*k+1);
}
inline bool cmpp(sb a,sb b){
if(a.k!=b.k)return a.k<b.k;
if(a.x==b.x)return a.y<b.y;
return a.x<b.x;
}
signed main(){
// freopen("in.in","r",stdin);
// freopen("out.out","w",stdout);
ios::sync_with_stdio(0);
cin.tie(0);cout.tie(0);
cin>>n;
for(int i=1;i<=n;i++)cin>>e[i].x>>e[i].y;
sort(e+1,e+1+n,cmp);
st[++top]=e[1];
xx=st[top].x,yy=st[top].y;
for(int i=2;i<=n;i++)e[i].k=atan2(e[i].y-yy,e[i].x-xx);
sort(e+2,e+1+n,cmpp);
st[++top]=e[2];
for(int i=3;i<=n;i++){
while(top>1&&cross(st[top-1],st[top],e[i])<=0)top--;
st[++top]=e[i];
}st[++top]=st[1];
int l=1,r=1;
double ans=0;
for(l=1;l<=top;l++){
while(dis(st[r+1],st[l+1],st[l])>=dis(st[r],st[l+1],st[l]))r=r%top+1;
ans=max({ans,ddd(st[r],st[l]),ddd(st[r],st[l+1])});
}
printf("%.7lf",ans);
return 0;
}/*10
0 0
100 -900
200 -1799
9800 -1799
9900 -900
10000 0
9999 100
9998 199
2 199
1 100
*/
詳細信息
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 6372kb
input:
1000 0 0 -997615 -8573 -1988394 -28911 -2726572 -44296 -3491635 -60392 -4419752 -82814 -5298550 -105946 -5723430 -118453 -6608257 -147267 -7034966 -161982 -7563964 -181682 -8507871 -222865 -9499799 -271846 -10090186 -303547 -10400262 -322989 -10614073 -339725 -11081438 -378596 -11791568 -439127 -127...
output:
274336382.4570426
result:
wrong answer 1st numbers differ - expected: '274339223.1895614', found: '274336382.4570426', error = '0.0000104'
Subtask #2:
score: 0
Skipped
Dependency #1:
0%
Subtask #3:
score: 0
Skipped
Dependency #1:
0%