QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#742562#9576. Ordainer of Inexorable JudgmentWolam#WA 1ms6260kbC++202.3kb2024-11-13 16:48:582024-11-13 16:48:59

Judging History

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

  • [2024-12-23 14:23:26]
  • hack成功,自动添加数据
  • (/hack/1303)
  • [2024-12-06 11:32:56]
  • hack成功,自动添加数据
  • (/hack/1271)
  • [2024-11-14 21:58:28]
  • hack成功,自动添加数据
  • (/hack/1181)
  • [2024-11-13 16:48:59]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:6260kb
  • [2024-11-13 16:48:58]
  • 提交

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(mi>nmx+1e-10&&mx+1e-10<nmi)
    {
        double mid=(mx+nmi)/2;
        double mx=cosl(mid),my=sinl(mid);
        bool t0=0,t1=0;
        for(int i=1;i<=n;i++)
        {
            double v=a[i].x*my-mx*a[i].y;
            if(v>1e-10)t0=1;
            if(v<1e-10)t1=1;
        }
        if(t0&&t1)
        {
            mi=nmx;
        }
        else
        {
            mx=nmi;
        }
    }
    if(nmx<0)
        nmx=nmi=mx;
    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();
}

详细

Test #1:

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

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: 5924kb

input:

3 1 0 1 2
1 2
2 1
2 2

output:

1.570796326795

result:

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

Test #3:

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

input:

3 1 0 1 10000
1 2
2 1
2 2

output:

2500.707752257475

result:

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

Test #4:

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

input:

3 10000 10000 1 10000
10000 9999
10000 10000
9999 10000

output:

0.384241300290

result:

ok found '0.3842413', expected '0.3842413', error '0.0000000'

Test #5:

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

input:

3 -10000 -10000 10000 10000
-10000 -9999
-10000 -10000
-9999 -10000

output:

2500.240670009608

result:

ok found '2500.2406700', expected '2500.2406700', error '0.0000000'

Test #6:

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

input:

4 1 0 1 10000
-2 3400
-4 10000
-4 -10000
-2 -3400

output:

7498.824012482161

result:

wrong answer 1st numbers differ - expected: '4999.2191154', found: '7498.8240125', error = '0.4999991'