QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#777037#9576. Ordainer of Inexorable JudgmentDarwinA66WA 1ms4196kbC++204.1kb2024-11-23 22:24:192024-11-23 22:24:20

Judging History

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

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

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 find_ans(double l1,double r1,double l2,double r2)
{
    //printf("%.6f %.6f %.6f %.6f\n",l1,r1,l2,r2);
    double ret;
    if(r1<l2||r2<l1)ret=0.00;
    else
    {
        if(l1<l2&&r2<l1)ret=1.00*(r2-l2);
        else if(l2<l1&&r1<r2)ret=1.00*(r1-l1);
        else 
        {
            if(l1<l2)ret=(r1-l2)*1.00;
            else ret=(r2-l1)*1.00;
        }
    }
    //printf("%.8f\n",ret);
    return ret;
}
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=1.00*get_theta_b(p[i].x,p[i].y);
            double eps=1.00*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-9)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)*1.00;
        double lenth=fabs(RR*1.00-LL*1.00)*1.00;
        double t0=t*1.00;
        while(t0>2.00*acos(-1.00))
        {
            t0-=2.00*acos(-1.00);
            ans+=lenth*1.00;
        }
        double rest=t0;
        LL-=2.00*acos(-1.00);
        while(fabs(LL-acos(-1.00))>1.00*acos(-1.00)+1e-9)LL+=2.00*acos(-1.00);
        RR-=2.00*acos(-1.00);
        while(fabs(RR-acos(-1.00))>1.00*acos(-1.00)+1e-9)RR+=2.00*acos(-1.00);
        if(LL<RR)
        {
            if(rest+curr>2.00*acos(-1.00))
            {
                ans+=find_ans(LL,RR,curr,2.00*acos(-1.00));
                ans+=find_ans(LL,RR,0.00,rest-2.00*acos(-1.00)+curr);
            }
            else
            {
                ans+=find_ans(LL,RR,curr,curr+rest);
            }
        }
        else
        {
            if(rest+curr>2.00*acos(-1.00))
            {
                ans+=find_ans(LL,2.00*acos(-1.00),curr,2.00*acos(-1.00));
                ans+=find_ans(LL,2.00*acos(-1.00),0.00,rest-2.00*acos(-1.00)+curr);
                ans+=find_ans(0.00,RR,curr,2.00*acos(-1.00));
                ans+=find_ans(0.00,RR,0.00,rest-2.00*acos(-1.00)+curr);
            }
            else
            {
                ans+=find_ans(LL,2.00*acos(-1.00),curr,curr+rest);
                ans+=find_ans(0.00,RR,curr,curr+rest);
            }
        }
        printf("%.10f\n",ans);
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 4196kb

input:

3 1 0 1 1
1 2
2 1
2 2

output:

0.00000000 1.57079633
1.0000000000

result:

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