QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#742655#9566. TopologyWolam#WA 1ms6012kbC++202.3kb2024-11-13 17:01:202024-11-13 17:01:20

Judging History

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

  • [2024-11-13 17:01:20]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:6012kb
  • [2024-11-13 17:01:20]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define double long double 
const double Pi=acosl(-1.0);
int n,X0,Y0,d,t;
double l[100005],r[100005];
struct ss{
    int x,y;
    ss operator -(const ss ot)const{
        return (ss){x-ot.x,y-ot.y};
    }
    double dis()
    {
        return sqrtl(x*x+y*y);
    }
}a[100005];
double mx,mi,nmx,nmi,len;
double calc(double k)
{
    double t=floor(k/(Pi*2));
    //if(k>1e-9)cout<<t*len<<endl;
    double ans=t*len;
    k-=t*2*Pi;
    if(k<mx)ans+=k;
    else
    {
        ans+=mx;
        if(k>nmi)
        {
            ans-=nmi;
            if(k>nmx)
            {
                ans+=nmx;
                if(k>mi)
                    ans+=k-mi;
            }
            else ans+=k;
        }
    }
    return ans;
}
void sol()
{
    cin>>n>>X0>>Y0>>d>>t;
    double st=atan2l((double)Y0,(double)X0);
    if(st<0)st+=Pi*2;
    mx=0,mi=2*Pi;
    nmx=-1,nmi=2*Pi+1;
    for(int i=1;i<=n;i++)
    {
        cin>>a[i].x>>a[i].y;
        double s1=asinl((double)d/a[i].dis());
        double s2=atan2l((double)a[i].y,(double)a[i].x);
        l[i]=s2-s1;
        r[i]=s2+s1;
        if(l[i]<0)l[i]+=2*Pi;
        if(r[i]<0)r[i]+=2*Pi;
        if(l[i]<r[i])
        {
            nmi=min(l[i],nmi);
            nmx=max(r[i],nmx);
        }
        else
        {
            mi=min(mi,l[i]);
            mx=max(mx,r[i]);
        }
    }
    if(nmi<mx)
    {
        nmi=mx;
        if(nmx<mx)
            nmx=mx;
    }
    if(nmx>mi)
    {
        nmx=mi;
        if(nmi>mi)
            nmi=mi;
    }
    if(nmx<0)
        nmx=nmi=mx;
    if(mi>nmx+1e-12&&mx+1e-12<nmi&&fabsl(mi-mx-2*Pi)>1e-12)
    {
        double mid=(mx+nmi)/2;
        double mmx=cosl(mid),mmy=sinl(mid);
        bool t0=0,t1=0;
        for(int i=1;i<=n;i++)
        {
            double v=a[i].x*mmy-mmx*a[i].y;
            if(v>1e-12)t0=1;
            if(v<-1e-12)t1=1;
        }
        if(t0&&t1)
        {
            mx=nmi;
        }
        else
        {
            mi=nmx;
        }
    }
    len=mx+2*Pi-mi+nmx-nmi;
    //cerr<<mi<<" "<<mx<<" "<<nmi<<" "<<nmx<<" "<<len<<" "<<st<<endl;
    cout<<fixed<<setprecision(12)<<calc(t+st)-calc(st)<<'\n';
}
signed main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    int T=1;
    while(T--)
        sol();
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

4
1 1 2

output:

0.000000000000

result:

wrong output format Expected integer, but "0.000000000000" found