QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#743233#9576. Ordainer of Inexorable JudgmenthjxddlWA 0ms4164kbC++202.2kb2024-11-13 18:39:022024-11-13 18:39:02

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 18:39:02]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:4164kb
  • [2024-11-13 18:39:02]
  • 提交

answer

// Coded by hjxddl
#include <bits/stdc++.h>
#define ll long long
#define db double
const db pi = acos(-1);
const int N = 2e5 + 5;
int n;
db x0, y6, d, t;
void solve() {
    std::cin >> n >> x0 >> y6 >> d >> t;
    db max1 = -1e9, min1 = 1e9, delta = -1e9;
    std::vector<db> A;
    for (int i = 1; i <= n; i++) {
        db x, y;
        std::cin >> x >> y;
        db a, b;
        if (x == d || x == -d)
            a = pi / 2;
        else {
            a = (x * y + d * (sqrt(x * x + y * y - d * d))) / (x * x - d * d);
            a = atan(a);
        }
        if (y == d || y == -d)
            b = 0;
        else {
            if (x != d && x != -d)
                b = (x * y - d * (sqrt(x * x + y * y - d * d))) / (x * x - d * d);
            else
                b = (y * y - d * d) / d / 2 / y;
            // std::cout << b << " " << (x == d || x == -d) << '\n';
            b = atan(b);
        }
        if (y < 0) a += pi;
        if (y < 0) b += pi;
        A.push_back(a);
        A.push_back(b);
        A.push_back(a + 2 * pi);
        A.push_back(b + 2 * pi);
        // std::cout << a << " " << b << '\n';
    }
    int n1 = A.size();
    for (int i = 0; i < n1; i++) {
        for (int j = 0; j < n1; j++) {
            if (fabs(A[i] - A[j]) <= pi && fabs(A[i] - A[j]) >= delta) {
                delta = fabs(A[i] - A[j]);
                max1 = std::max(A[i], A[j]);
                min1 = std::min(A[i], A[j]);
                // std::cout << A[i] << " " << A[j] << '\n';
            }
        }
    }
    db ans = 0;
    ans += db(int(t / 2 / pi)) * delta;
    t -= db(int(t / 2 / pi)) * 2 * pi;
    db now;
    if (x0)
        now = atan(y6 / x0);
    else
        now = pi / 2;
    if (y6 < 0) now += pi;
    db now1 = now + t;
    if (min1 >= 2 * pi) max1 -= 2 * pi, min1 -= 2 * pi;
    ans += std::min(now1, max1) - std::max(now, min1);
    std::cout << std::fixed << std::setprecision(10) << ans << '\n';
}
int main() {
    std::ios::sync_with_stdio(0);
    std::cin.tie(0), std::cout.tie(0);
    int t = 1;
    // std::cin >> t;
    while (t--) {
        solve();
    }
    std::cout << std::flush;
    // system("pause");
}

详细

Test #1:

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

input:

3 1 0 1 1
1 2
2 1
2 2

output:

1.0000000000

result:

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

Test #2:

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

input:

3 1 0 1 2
1 2
2 1
2 2

output:

1.5707963268

result:

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

Test #3:

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

input:

3 1 0 1 10000
1 2
2 1
2 2

output:

2500.7077522575

result:

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

Test #4:

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

input:

3 10000 10000 1 10000
10000 9999
10000 10000
9999 10000

output:

0.3842413003

result:

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

Test #5:

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

input:

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

output:

4998.9002020695

result:

wrong answer 1st numbers differ - expected: '2500.2406700', found: '4998.9002021', error = '0.9993676'