QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#745119#9576. Ordainer of Inexorable JudgmentPinkRabbitWA 1ms4320kbC++202.2kb2024-11-14 05:09:252024-11-14 05:09:26

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-14 05:09:26]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:4320kb
  • [2024-11-14 05:09:25]
  • 提交

answer

#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>
#include <set>
#include <cmath>
#include <iomanip>
using std::cin, std::cout;

#define F(i, a, b) for(int i = a; i <= (b); ++i)
#define F2(i, a, b) for(int i = a; i < (b); ++i)
#define dF(i, a, b) for(int i = a; i >= (b); --i)

void Solve();
int main() {
    cin.sync_with_stdio(false);
    cin.tie(nullptr);
    int tests = 1;
    while (tests--)
        Solve();
    return 0;
}

void Solve() {
    int n, d;
    double t;
    cin >> n;
    std::vector<double> x(n + 1), y(n + 1);
    cin >> x[0] >> y[0] >> d >> t;
    F(i, 1, n)
        cin >> x[i] >> y[i];
    {
        int id = 0;
        double pdis = 1e99;
        F(i, 1, n) {
            double dis = std::hypot(x[i], y[i]);
            if (dis < pdis)
                pdis = dis,
                id = i;
        }
        double theta = -std::atan2(y[id], x[id]);
        double cos = std::cos(theta);
        double sin = std::sin(theta);
        F(i, 0, n) {
            double nx = cos * x[i] - sin * y[i];
            double ny = sin * x[i] + cos * y[i];
            x[i] = nx;
            y[i] = ny;
        }
    }
    double min_g = 1e9, max_g = -1e9;
    F(i, 1, n) {
        double theta = std::atan2(y[i], x[i]);
        double phi = std::asin(d / std::hypot(x[i], y[i]));
        min_g = std::min(min_g, theta - phi);
        max_g = std::max(max_g, theta + phi);
    }
    cout << min_g << ' ' << max_g << '\n';
    double ans = 0;
    const double pi = std::acos(-1);
    double igamma = std::atan2(y[0], x[0]) + 2 * pi;
    double t2 = igamma + t;
    double t1 = igamma;
    int nn;
    //===
    nn = t2 / (2 * pi);
    ans += nn * (max_g - min_g);
    t2 -= nn * (2 * pi);
    if (t2 <= max_g)
        ans += t2;
    else {
        ans += max_g;
        if (t2 >= 2 * pi + min_g)
            ans += t2 - (2 * pi + min_g);
    }
    //===
    nn = t1 / (2 * pi);
    ans -= nn * (max_g - min_g);
    t1 -= nn * (2 * pi);
    if (t1 <= max_g)
        ans -= t1;
    else {
        ans -= max_g;
        if (t1 >= 2 * pi + min_g)
            ans -= t1 - (2 * pi + min_g);
    }
    //===
    cout << std::fixed << std::setprecision(12) << ans << '\n';
}

詳細信息

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 4320kb

input:

3 1 0 1 1
1 2
2 1
2 2

output:

-1.10715 0.463648
1.000000000000

result:

wrong answer 1st numbers differ - expected: '1.0000000', found: '-1.1071500', error = '2.1071500'