QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#586139 | #784. 旋转卡壳 | houbur | 0 | 1ms | 6456kb | C++20 | 1.3kb | 2024-09-24 06:53:55 | 2024-09-24 06:53:56 |
Judging History
你现在查看的是最新测评结果
- [2024-10-16 12:18:36]
- hack成功,自动添加数据
- (/hack/1005)
- [2024-09-24 16:55:39]
- hack成功,自动添加数据
- (/hack/888)
- [2024-09-24 06:53:55]
- 提交
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 dis(sb a,sb b){return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(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 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=1;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];
}
int mx=0,l=1,r=0;
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=mx;
for(l=1;l<=top;l++){
while(dis(st[(r==top)?1:(r+1)],st[l])>=dis(st[r],st[l]))(r==top)?(r=1):(r++);
ans=max(ans,sqrt((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: 10
Accepted
time: 0ms
memory: 6364kb
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:
274339223.1895614
result:
ok found '274339223.1895614', expected '274339223.1895614', error '0.0000000'
Test #2:
score: 10
Accepted
time: 1ms
memory: 6456kb
input:
1000 0 0 -887614 -1937 -1459359 -3808 -2421409 -24096 -3273181 -48456 -3917594 -76664 -4402753 -100164 -5375022 -150897 -5993935 -192089 -6587159 -238825 -7549680 -333298 -8330993 -416479 -9244392 -515027 -10010900 -598589 -10374584 -640275 -10767641 -686907 -11173081 -741316 -11821952 -833327 -1260...
output:
262687047.9274906
result:
ok found '262687047.9274906', expected '262687047.9274906', error '0.0000000'
Test #3:
score: 10
Accepted
time: 1ms
memory: 6372kb
input:
1000 0 0 -631055 -2758 -1328409 -7463 -2248672 -20536 -2412978 -23564 -2659543 -28441 -3383179 -43406 -4183375 -64326 -4856658 -88337 -5799682 -134822 -6757348 -189404 -7132846 -212164 -7563226 -242116 -8368716 -300012 -9321463 -381770 -9831821 -432746 -10409503 -491057 -11360852 -607259 -11874199 -...
output:
257868038.6435897
result:
ok found '257868038.6435897', expected '257868038.6435897', error '0.0000000'
Test #4:
score: 10
Accepted
time: 1ms
memory: 6368kb
input:
1000 0 0 -48652 -588 -951356 -20091 -1517426 -33325 -1965414 -51971 -2466111 -74904 -3046762 -103888 -3555833 -132002 -3976901 -156059 -4972848 -245498 -5921476 -332492 -6353035 -375491 -7327511 -496188 -7939064 -575429 -8842272 -694656 -9246222 -756797 -9771758 -860630 -10633761 -1031205 -10981774 ...
output:
259539672.4804534
result:
ok found '259539672.4804534', expected '259539672.4804534', error '0.0000000'
Test #5:
score: 10
Accepted
time: 1ms
memory: 6400kb
input:
1000 0 0 -456569 -2668 -1141521 -7887 -1270801 -8967 -1971135 -21206 -2919889 -38188 -3903859 -71231 -4752603 -107450 -5508682 -143873 -6214620 -183392 -6718977 -212193 -7452291 -271600 -8408796 -354998 -9261882 -432674 -9528618 -457608 -10099091 -513153 -10320120 -535958 -11067358 -614356 -12050731...
output:
250217366.4826218
result:
ok found '250217366.4826218', expected '250217366.4826218', error '0.0000000'
Test #6:
score: 0
Wrong Answer
time: 1ms
memory: 6360kb
input:
1000 0 0 -794019 -17307 -1389128 -41522 -1928884 -68000 -2530256 -103641 -3335109 -158872 -4273633 -225636 -4655012 -253747 -5584931 -329387 -6190262 -382029 -6657521 -422826 -7445510 -497270 -8092482 -562235 -8879759 -646264 -9688106 -745847 -10545954 -857573 -11350736 -962711 -12106702 -1066386 -1...
output:
256129171.6917825
result:
wrong answer 1st numbers differ - expected: '256130723.0053680', found: '256129171.6917825', error = '0.0000061'
Subtask #2:
score: 0
Skipped
Dependency #1:
0%
Subtask #3:
score: 0
Skipped
Dependency #1:
0%