QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#728710#9576. Ordainer of Inexorable Judgmentucup-team3802#WA 1ms3868kbC++231.4kb2024-11-09 15:44:392024-11-09 15:44:39

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-09 15:44:39]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3868kb
  • [2024-11-09 15:44:39]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define all(a) a.begin(), a.end()
#define rep(i, a, b) for(ll i = a; i < b; i++)
ld PI = acosl(-1);
ld PI2 = PI * 2;

ld mod_PI2(ld x){
    while(x < 0) x += PI2;
    while(x >= PI2) x -= PI2;
    return x;
}

void solve(){
    ll n,x,y,d,t;
    cin >> n >> x >> y >> d >> t;
    ld first = atan2l(y, x);
    
    vector<ld> th1,th2;

    rep(i, 0, n){
        ll dx,dy;
        cin >> dx >> dy;
        ld th = atan2l(dy, dx);
        ld dth = atan2l(d, sqrtl((dx * dx + dy * dy) - d * d));
        th1.push_back(mod_PI2(th + dth));
        th2.push_back(mod_PI2(th - dth));
    }

    sort(all(th1)); // mx
    sort(all(th2)); // mn

    ld mx, mn;
    rep(i, 0, n){
        if(mod_PI2(th1[i] - th1[(i+1)%n]) < PI) mx = th1[i];
        if(mod_PI2(th2[i] - th2[(i+1)%n]) < PI) mn = th2[(i+1)%n];
    }
    ld ans = 0;

    ld mt = mod_PI2(t);
    ans += (t - mt) / PI2 * mod_PI2(mx - mn);

    mt = mod_PI2(mt - first);
    mx = mod_PI2(mx - first);
    mn = mod_PI2(mn - first);

    if(mx < mn){
        if(mx < mt) ans += mx;
        else ans += mt;
        if(mn < mt) ans += mt - mn;
    }else{
        if(mn < mt){
            ans += min(mx, mt) - mn;
        }
    }

    cout << fixed << setprecision(20) << ans << endl;
}

int main(){
    int t = 1;
    while(t--){
        solve();
    }
}

詳細信息

Test #1:

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

input:

3 1 0 1 1
1 2
2 1
2 2

output:

1.00000000000000000000

result:

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

Test #2:

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

input:

3 1 0 1 2
1 2
2 1
2 2

output:

1.57079632679489661915

result:

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

Test #3:

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

input:

3 1 0 1 10000
1 2
2 1
2 2

output:

2500.70775225747542913624

result:

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

Test #4:

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

input:

3 10000 10000 1 10000
10000 9999
10000 10000
9999 10000

output:

0.38424130029026483052

result:

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

Test #5:

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

input:

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

output:

2500.55135363829672257019

result:

wrong answer 1st numbers differ - expected: '2500.2406700', found: '2500.5513536', error = '0.0001243'