QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#121710#860. We apologize for any inconveniencekaruna#WA 1ms3584kbC++171.0kb2023-07-08 18:46:442023-07-08 18:46:47

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-07-08 18:46:47]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3584kb
  • [2023-07-08 18:46:44]
  • 提交

answer

#include <bits/stdc++.h>
#define ff first
#define ss second
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

int main() {
    cin.tie(0); ios_base::sync_with_stdio(0);
    int T; cin >> T;
    while (T--) {
        int C; cin >> C;
        int n; cin >> n;
        vector<pair<int, int>> a(n);
        for (auto &[x, y] : a) cin >> x >> y;
        
        int x_max = 0;
        for (auto [x, y] : a) x_max = max(x_max, x);

        long double l = 0, r = 1e18;
        for (auto [x, y] : a) {
            long double A = 5.0 * x * x / C / C;

            long double sq = sqrt((long long)x * x - 4 * A * (A + y));
            l = max(l, (x - sq) / (2 * A));
            r = min(r, (x + sq) / (2 * A));
        }
        long double A = 5.0 * x_max / C / C;
        l = max(l, (1 - sqrt(1 - 4 * A * A)) / (2 * A));
        r = min(r, (1 + sqrt(1 - 4 * A * A)) / (2 * A));

        cout.precision(3);
        cout << fixed << (l + r) / 2 << '\n';
    }
}

詳細信息

Test #1:

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

input:

1
5 4
3 1 3 5
2 1 4
2 2 3
2 2 4
3
1
4
3

output:

-nan

result:

wrong output format Expected integer, but "-nan" found