QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#786650#9576. Ordainer of Inexorable JudgmentOdtreePrinceWA 1ms6364kbC++171.9kb2024-11-26 22:39:312024-11-26 22:39:31

Judging History

你现在查看的是最新测评结果

  • [2024-12-23 14:23:26]
  • hack成功,自动添加数据
  • (/hack/1303)
  • [2024-12-06 11:32:56]
  • hack成功,自动添加数据
  • (/hack/1271)
  • [2024-11-26 22:39:31]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:6364kb
  • [2024-11-26 22:39:31]
  • 提交

answer

#include <bits/stdc++.h>
#define N 400005
#define LL long long
#define inf 2147483647
#define LD long double
#define eps 1e-8
using namespace std;
int n,X0,Y0,d,X[N],Y[N];const double pi=acos(-1.0);double t;
inline double pr(double x){return x*x;}inline double dis(double X1,double Y1,double X2,double Y2){return sqrt(pr(X2-X1)+pr(Y2-Y1));}
inline double mul(double X1,double Y1,double X2,double Y2){return X1*Y2-X2*Y1;}
inline double dot(double X1,double Y1,double X2,double Y2){return (X1*X2+Y1*Y2)/(dis(0,0,X1,Y1)*dis(0,0,X2,Y2));}
inline bool check(double X2,double Y2,double X3,double Y3,double X4,double Y4){return mul(X2,Y2,X3,Y3)*mul(X2,Y2,X4,Y4)<0;}
inline bool check(double thi){
    double x=cos(thi),y=sin(thi);
    for(int i=1;i<=n;i++) if(check(x,y,X[i],Y[i],X[i%n+1],Y[i%n+1])&&fabs(acos(dot(x,y,X[i],Y[i]))+acos(dot(x,y,X[i%n+1],Y[i%n+1]))-acos(dot(X[i%n+1],Y[i%n+1],X[i],Y[i])))<eps) return 1;
    for(int i=1;i<=n;i++) if(fabs(mul(x,y,X[i],Y[i]))<=d&&dot(x,y,X[i],Y[i])>0) return 1;return 0;
}
inline void solve(int tc){
    cin>>n>>X0>>Y0>>d>>t;for(int i=1;i<=n;i++) cin>>X[i]>>Y[i];
    double thi=acos(X[1]/dis(0,0,X[1],Y[1]));if(Y[1]<0) thi=2*pi-thi;
    double l=0,r=pi;while(r-l>eps){double mid=(l+r)/2.0;if(check(mid+thi)) l=mid;else r=mid;}
    double t1=l+thi;l=0,r=pi;while(r-l>eps){double mid=(l+r)/2.0;if(check(thi-mid)) l=mid;else r=mid;}
    double t2=thi-l;thi=acos(X0/dis(0,0,X0,Y0));if(Y0<0) thi=2*pi-thi;
    int rd=(int)(t/(2.0*pi));t-=2.0*rd*pi;double ans=1.0*rd*(t1-t2);
    t1-=t2,thi-=t2,t2=0;if(thi>=2.0*pi+eps) thi-=2.0*pi;if(thi<-eps) thi+=2.0*pi;
    if(thi<=t1) ans+=min(t,t1-thi)+max(0.0,t-(2.0*pi-thi));else if(thi+t>=2.0*pi) ans+=min(thi+t-2.0*pi,t1);printf("%.12f\n",ans);
}
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    int tc=1;
    // cin>>tc;
    while(tc--) solve(tc);
    return 0;
}
/*
3 0 1 1 6
1 2
2 1
2 2

*/

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 6296kb

input:

3 1 0 1 1
1 2
2 1
2 2

output:

1.000000000000

result:

ok found '1.0000000', expected '1.0000000', error '0.0000000'

Test #2:

score: 0
Accepted
time: 1ms
memory: 6292kb

input:

3 1 0 1 2
1 2
2 1
2 2

output:

1.570796324429

result:

ok found '1.5707963', expected '1.5707963', error '0.0000000'

Test #3:

score: 0
Accepted
time: 0ms
memory: 4128kb

input:

3 1 0 1 10000
1 2
2 1
2 2

output:

2500.707742945098

result:

ok found '2500.7077429', expected '2500.7077523', error '0.0000000'

Test #4:

score: -100
Wrong Answer
time: 1ms
memory: 6364kb

input:

3 10000 10000 1 10000
10000 9999
10000 10000
9999 10000

output:

0.384233133852

result:

wrong answer 1st numbers differ - expected: '0.3842413', found: '0.3842331', error = '0.0000082'