QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#585575 | #784. 旋转卡壳 | houbur | 0 | 3ms | 6140kb | C++20 | 1.3kb | 2024-09-23 21:18:11 | 2024-09-23 21:18:11 |
Judging History
你现在查看的是最新测评结果
- [2024-10-16 12:18:36]
- hack成功,自动添加数据
- (/hack/1005)
- [2024-09-24 16:55:39]
- hack成功,自动添加数据
- (/hack/888)
- [2024-09-23 21:18:11]
- 提交
answer
#include<bits/stdc++.h>
using namespace std;
const int N=3e5+5;
int n,m,top,xx,yy;
#define double long double
struct sb{
double x,y;
}e[N];
sb st[N];
bool cmp(sb a,sb b){return (a.y==b.y)?(a.x<b.x):(a.y<b.y);}
double dis(sb a,sb b){return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y));}
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);}
bool cmpp(sb a,sb b){
double k1=atan2(a.y-yy,a.x-xx),k2=atan2(b.y-yy,b.x-xx);
if(k1!=k2)return k1<k2;
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;
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];
}
for(int i=1;i<=top;i++)st[i+top]=st[i];
int mx=0,l=1,r=1;
for(int i=1;i<=top;i++){
int op=dis(st[i],st[1]);
if(op>mx){mx=op;r=i;}
else break;
}
double ans=0;
for(l=1;l<=top;l++){
while(r<=top*2&&dis(st[r+1],st[l])>=dis(st[r],st[l]))r++;
ans=max(ans,((st[l].x-st[r].x)*(st[l].x-st[r].x)+(st[l].y-st[r].y)*(st[l].y-st[r].y)));
}
printf("%.7Lf",ans);
return 0;
}
詳細信息
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 3ms
memory: 6140kb
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:
75262009380251978.0000000
result:
wrong answer 1st numbers differ - expected: '274339223.1895614', found: '75262009380251984.0000000', error = '274339222.1895615'
Subtask #2:
score: 0
Skipped
Dependency #1:
0%
Subtask #3:
score: 0
Skipped
Dependency #1:
0%