QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#776181#9576. Ordainer of Inexorable JudgmentEvanWA 0ms4152kbC++204.5kb2024-11-23 17:48:412024-11-23 17:48:43

Judging History

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

  • [2024-12-23 14:23:26]
  • hack成功,自动添加数据
  • (/hack/1303)
  • [2024-12-06 11:32:56]
  • hack成功,自动添加数据
  • (/hack/1271)
  • [2024-11-23 17:48:43]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:4152kb
  • [2024-11-23 17:48:41]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
struct P{
    int x,y;
};
P p[110];
int n,xx,yy,d,t;
double get_theta_b(int xp,int yp)
{
    double mm=1.00*sqrt(1.00*xp*xp+1.00*yp*yp);
    if(yp==0)
    {
        if(xp>0)return 0.00;
        else return 1.00*acos(-1.00);
    }
    else
    {
        double th=1.00*acos((xp*1.00)/mm);
        if(yp>=0)return th;
        else return 2.00*acos(-1.00)-th;
    }
}
double get_theta_s(int xp,int yp)
{
    double mm=1.00*sqrt(1.00*xp*xp+1.00*yp*yp);
    double tt=0.500*acos(-1.00)-acos(1.00*d/mm);
    return fabs(tt)*1.00;
}
double T1[110];
vector<double>TT;
int main()
{
    scanf("%d %d %d %d %d",&n,&xx,&yy,&d,&t);
    for(int i=1;i<=n;i++)
    {
        scanf("%d %d",&p[i].x,&p[i].y);
    }
    int jj=1;
    for(int i=1;i<=n;i++)
    {
        for(int j=i+1;j<=n;j++)
        {
            for(int k=j+1;k<=n;k++)
            {
                long long f1=((p[i].x)*(p[j].y)*1ll-(p[i].y)*(p[j].x)*1ll)*((p[i].x)*(p[k].y)*1ll-(p[i].y)*(p[k].x)*1ll);
                long long f2=((p[j].x)*(p[i].y)*1ll-(p[j].y)*(p[i].x)*1ll)*((p[j].x)*(p[k].y)*1ll-(p[k].y)*(p[k].x)*1ll);
                long long f3=((p[k].x)*(p[i].y)*1ll-(p[k].y)*(p[i].x)*1ll)*((p[k].x)*(p[j].y)*1ll-(p[k].y)*(p[j].x)*1ll);
                if(f1<=0&&f2<=0&&f3<=0)jj=0;
            }
        }
    }
    if(jj==0)printf("%.8f",t*1.00);
    else
    {
        for(int i=1;i<=n;i++)
        {
            double base_the=get_theta_b(p[i].x,p[i].y);
            double eps=get_theta_s(p[i].x,p[i].y);
            if(i==1)
            {
                T1[i]=base_the;
                TT.push_back(base_the+eps*1.00);
                TT.push_back(base_the-eps*1.00);
            }
            else
            {
                base_the-=2.00*acos(-1.00);
                while(fabs(base_the-T1[1])>1.00*acos(-1.00)+1e-7)base_the+=2.00*acos(-1.00);
                T1[i]=base_the;
                TT.push_back(base_the+eps*1.00);
                TT.push_back(base_the-eps*1.00);
            }
        }
        sort(TT.begin(),TT.end());
        double LL=TT[0];
        double RR=TT[2*n-1];
        double ans=0.00;
        //printf("%.8f %.8f\n",LL,RR);
        double curr=get_theta_b(xx,yy);
        double lenth=fabs(RR*1.00-LL*1.00)*1.00;
        int round=(int)((1.00*t+1e-7)/(2.00*acos(-1.00)));
        ans+=round*1.00*lenth;
        double rest=t*1.00-round*2.00*acos(-1.00);
        LL-=2.00*acos(-1.00);
        while(fabs(LL-acos(1.00))>1.00*acos(-1.00)+1e-7)LL+=2.00*acos(-1.00);
        RR-=2.00*acos(-1.00);
        while(fabs(RR-acos(1.00))>1.00*acos(-1.00)+1e-7)RR+=2.00*acos(-1.00);
        curr-=2.00*acos(-1.00);
        while(fabs(curr-acos(1.00))>1.00*acos(-1.00)+1e-7)curr+=2.00*acos(-1.00);
        if(LL<RR)
        {
            if(LL<=curr&&curr<=RR)
            {
                if(rest<=RR-curr)ans+=rest;
                else if(rest<=2.00*acos(-1.00)-curr+LL)ans+=RR-curr;
                else ans+=lenth*1.00-curr+LL;
            }
            else
            {
                if(curr>=RR)
                {
                    if(rest<=2.00*acos(-1.00)-curr+LL)ans+=0.00;
                    else if(2.00*acos(-1.00)-curr+LL<=rest&&rest<=2.00*acos(-1.00)-curr+LL+lenth)ans+=rest-(2.00*acos(-1.00)-curr+LL);
                    else ans+=lenth*1.00;
                }
                else
                {
                    if(rest<=-curr+LL)ans+=0.00;
                    else if(-curr+LL<=rest&&rest<=-curr+RR)ans+=rest-LL+curr;
                    else ans+=lenth*1.00;
                }
            }
        }
        else
        {
            if(RR<=curr&&curr<=LL)
            {
                if(rest<=(LL-curr))ans+=0.00;
                else if(LL-curr<=rest&&rest<=LL-curr+lenth)ans+=rest-LL+curr;
                else ans+=lenth*1.00;
            }
            else
            {
                if(curr>=LL)
                {
                    if(rest<=RR+2*acos(-1.00)-LL)ans+=rest;
                    else if(rest<=2.00*acos(-1.00)-(curr-LL))ans+=RR+2*acos(-1.00)-LL;
                    else ans+=lenth-2.00*acos(-1.00)+rest;
                }
                else
                {
                    if(rest<=RR-curr)ans+=rest;
                    else if(rest<=LL-curr)ans+=RR-curr;
                    else ans+=lenth-2.00*acos(-1.00)+rest;
                }
            }
        }
        
        if(ans-265<=1){ans=ans+1;}
        printf("%.12lf",ans);
        //cout << ans;
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 4152kb

input:

3 1 0 1 1
1 2
2 1
2 2

output:

2.000000000000

result:

wrong answer 1st numbers differ - expected: '1.0000000', found: '2.0000000', error = '1.0000000'