QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#718387#9576. Ordainer of Inexorable JudgmentEwiGKeiTWA 1ms3944kbC++141.8kb2024-11-06 20:23:212024-11-06 20:23:27

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-06 20:23:27]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3944kb
  • [2024-11-06 20:23:21]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef long double LB;
const LL MOD=1e9+7;
const LL INF=1e9;
const LB eps=1e-9;
const LB PI=acos(-1);
struct Point
{
    LB x,y,ang;
    Point operator-(const Point& p) const
    {
        return {x-p.x,y-p.y};
    }
    LB operator*(const Point& p) const
    {
        return x*p.y-y*p.x;
    }
} p[105];
int n;
LB X0,Y0,d,t,enter[105],leave[105],ans;
void normalize(LB &x)
{
    while (x<-eps) x+=PI*2;
}
signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0),cout.tie(0);

    cin >> n >> X0 >> Y0 >> d >> t;
    for (int i=1;i<=n;i++)
    {
        cin >> p[i].x >> p[i].y;
        LB l=sqrt(p[i].x*p[i].x+p[i].y*p[i].y),
           ang=atan2(p[i].y,p[i].x);
        normalize(ang);
        LB ang1=asin(d/l);
        enter[i]=ang-ang1;
        leave[i]=ang+ang1;
    }

    Point o={0,0};
    int news=0;
    for (int i=1;i<=n;i++)
    {
        bool ok=true;
        for (int j=1;j<=n;j++)
            if (i!=j && (p[i]-o)*(p[j]-p[i])<0)
            {
                ok=false;
                break;
            }
        if (ok) news=i;
    }

    double offset=enter[news];
    LB em=PI*2,lm=0;
    for (int i=1;i<=n;i++)
    {
        enter[i]-=offset;
        normalize(enter[i]);
        leave[i]-=offset;
        normalize(leave[i]);

        em=min(em,enter[i]);
        lm=max(lm,leave[i]);
    }

    LB start=atan2(Y0,X0)-offset;
    normalize(start);
    LB em2=max(em,start),
       lm2=max(lm,start);
    if (t-(em2-start)>0) ans+=min(t-(em2-start),lm2-em2);

    t-=PI*2-start;
    while (t>em)
    {
        ans+=min(t-em,lm-em);
        t-=PI*2;
    }

    cout << fixed << setprecision(9) << ans << '\n';
    return 0;
}

详细

Test #1:

score: 100
Accepted
time: 1ms
memory: 3748kb

input:

3 1 0 1 1
1 2
2 1
2 2

output:

1.000000000

result:

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

Test #2:

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

input:

3 1 0 1 2
1 2
2 1
2 2

output:

1.570796327

result:

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

Test #3:

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

input:

3 1 0 1 10000
1 2
2 1
2 2

output:

2500.707752257

result:

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

Test #4:

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

input:

3 10000 10000 1 10000
10000 9999
10000 10000
9999 10000

output:

0.384241300

result:

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

Test #5:

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

input:

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

output:

2500.240670010

result:

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

Test #6:

score: -100
Wrong Answer
time: 0ms
memory: 3816kb

input:

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

output:

4999.209750691

result:

wrong answer 1st numbers differ - expected: '4999.2191154', found: '4999.2097507', error = '0.0000019'