QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#757911#9576. Ordainer of Inexorable Judgmentucup-team173#WA 0ms4328kbC++202.0kb2024-11-17 14:31:362024-11-17 14:31:37

Judging History

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

  • [2024-12-23 14:23:26]
  • hack成功,自动添加数据
  • (/hack/1303)
  • [2024-12-06 11:32:56]
  • hack成功,自动添加数据
  • (/hack/1271)
  • [2024-11-17 14:31:37]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:4328kb
  • [2024-11-17 14:31:36]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

using ll = long long;

#define double long double

const double pi = acos(-1);
#define x0 laksjdfla
#define y0 laksjdf
int n, x0, y0, d;
double t;
int x[111], y[111];
double in[111], out[111];
double norm(double t) {
    while (t < -pi) t += pi*2;
    while (t >= pi) t -= pi*2;
    return t;
}
void solve() {
    cin >> n >> x0 >> y0 >> d >> t;
    for (int i = 1; i <= n; i++) {
        cin >> x[i] >> y[i];
        double t = asin(1. * d / sqrt(x[i] * x[i] + y[i] * y[i]));
        in[i] = atan2(y[i], x[i]) - t;
        out[i] = atan2(y[i], x[i]) + t;
    }
    int u = 1, v = 1;
    for (int i = 1; i <= n; i++) {
        if (norm(in[u] - in[i]) > 0) u = i;
        if (norm(out[i] - out[v]) > 0) v = i;
    }
    double l = norm(in[u]);
    double r = norm(out[v]);
    vector<pair<double, double>> o, p;
    auto add = [&](vector<pair<double, double>>& o, double l, double r) {
        if (l <= r) {
            o.push_back(make_pair(l, r));
        } else {
            o.push_back(make_pair(l, pi));
            o.push_back(make_pair(-pi, r));
        }
    };
    // cerr<<l<<" "<<r<<"\n";

    add(o, l, r);

    double ans = 0;
    double s = 0;
    for (auto oo : o) s += oo.second - oo.first;
    int round = t / (pi*2);
    ans += round * s;
    t -= round * (pi*2);
    // cout<<t<<" "<<round<<"\n";
    double L = norm(atan2(y0, x0));
    double R = norm(L + t);
    // cerr<<L<<" "<<R<<"\n";
    add(p, L, R);

    for (auto oo : o) {
        for (auto pp : p) {
            // cerr<<oo.first<<" "<<oo.second<<" "<<pp.first<<" "<<pp.second<<"\n";
            ans += max((double)0., min(oo.second, pp.second) - max(oo.first, pp.first));
        }
    }
    cout <<fixed<<setprecision(20)<< ans << "\n";
    
}
signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
    int t = 1;
    // cin >> t;
    while (t--) solve();
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

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

input:

3 1 0 1 2
1 2
2 1
2 2

output:

1.57079632679489650249

result:

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

Test #3:

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

input:

3 1 0 1 10000
1 2
2 1
2 2

output:

2500.70775225747523196063

result:

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

Test #4:

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

input:

3 10000 10000 1 10000
10000 9999
10000 10000
9999 10000

output:

0.38436201700422355579

result:

wrong answer 1st numbers differ - expected: '0.3842413', found: '0.3843620', error = '0.0001207'