QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#715551#9576. Ordainer of Inexorable JudgmentTianNiYiKou (Keyan Dong, Jialin Wu, Haoyu Zhang)WA 0ms4232kbC++202.5kb2024-11-06 12:30:132024-11-06 12:30:13

Judging History

This is the latest submission verdict.

  • [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 12:30:13]
  • Judged
  • Verdict: WA
  • Time: 0ms
  • Memory: 4232kb
  • [2024-11-06 12:30:13]
  • Submitted

answer

/*

                                _/                                      _/
       _/_/        _/_/_/      _/_/_/        _/_/_/      _/  _/_/               _/_/_/
    _/    _/    _/            _/    _/    _/    _/      _/_/          _/       _/    _/
   _/    _/    _/            _/    _/    _/    _/      _/            _/       _/    _/
    _/_/        _/_/_/      _/    _/      _/_/_/      _/            _/       _/    _/

*/
#include<bits/stdc++.h>
#define int long long
#define double long double
using namespace std;

const double PI = std::acos(-1);

void solve(){
    int n, x0, y0, d, t;
    std::cin >> n >> x0 >> y0 >> d >> t;

    std::vector<double> q;

    double st = std::acos(x0 / std::sqrt(x0 * x0 + y0 * y0));
    if (y0 < 0) {
        st = 2 * PI - st;
    }


    for (int i = 1; i <= n; i++) {
        int x, y;
        std::cin >> x >> y;
        double theta = std::acos(x / std::sqrt(x * x + y * y));
        double alpha = std::asin(d / std::sqrt(x * x + y * y));
        if (y < 0) {
            theta = 2 * PI - theta;
        }

        double a1 = theta - alpha;
        double a2 = theta + alpha;

        while (a1 >= 2 * PI) {
            a1 -= 2 * PI;
        }
        while (a1 < 0) {
            a1 += 2 * PI;
        }

        while (a2 >= 2 * PI) {
            a2 -= 2 * PI;
        }
        while (a2 < 0) {
            a2 += 2 * PI;
        }

        q.push_back(a1);
        q.push_back(a2);
    }

    std::sort(q.begin(), q.end());

    double ans = 0;
    const double eps = 1E-8;
    int tot = std::floor(t / 2 / PI);

    double remain = t - tot * 2 * PI;


    for (int i = 1; i < q.size(); i++) {
        if (q[i] - q[i - 1] >= PI) {
            double l1, r1, l2, r2;
            l1 = 0, r1 = q[i - 1];
            l2 = q[i], r2 = 2 * PI;
            double ed = st + t - remain;
            ans += tot * (r1 - l1 + r2 - l2);
            ans += std::min(ed, r1) - std::max(st, l1) + std::min(ed, r2) - std::max(st, l2);
            std::cout << ans << "\n";
            return;
        }
    }

    double l = q[0], r = q.back();
    double ed = st + remain;
    // std::cerr << remain << " " << l << " " << r << " " << st << " " << ed << "\n";
    ans += tot * (r - l);
    ans += std::min(ed, r) - std::max(st, l);
    std::cout << ans << "\n";




}

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    std::cout<< fixed << std::setprecision(12);
    int T=1;
    while(T--) solve();
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

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: 0ms
memory: 4220kb

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: 0ms
memory: 4232kb

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: 0ms
memory: 4156kb

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: 0ms
memory: 4136kb

input:

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

output:

2500.240670009609

result:

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

Test #6:

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

input:

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

output:

4999.219115408743

result:

ok found '4999.2191154', expected '4999.2191154', error '0.0000000'

Test #7:

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

input:

4 1 0 1 10000
-2 3300
-4 10000
-4 -10000
-2 -3300

output:

4999.200391854814

result:

ok found '4999.2003919', expected '4999.2003919', error '0.0000000'

Test #8:

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

input:

4 -3040 2716 2147 2
-9033 -8520
-8999 -8533
-8988 -8511
-9004 -8495

output:

0.350830058342

result:

ok found '0.3508301', expected '0.3508301', error '0.0000000'

Test #9:

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

input:

3 8168 -766 1549 1256
-3951 -6425
-3874 -6439
-3911 -6389

output:

82.597400198532

result:

wrong answer 1st numbers differ - expected: '84.8328612', found: '82.5974002', error = '0.0263514'