QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#179992#7127. 3 pointsucup-team004WA 1ms3992kbC++201.0kb2023-09-15 14:17:142023-09-15 14:17:14

Judging History

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

  • [2023-09-15 14:17:14]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3992kb
  • [2023-09-15 14:17:14]
  • 提交

answer

#include <bits/stdc++.h>

using i64 = long long;
using real = long double;

constexpr real eps = 1E-9;

int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    
    int x[3], y[3];
    for (int i = 0; i < 3; i++) {
        std::cin >> x[i] >> y[i];
    }
    
    auto get = [&](const auto &f) {
        real lo = -1E4, hi = 1E4;
        while (hi - lo > 3 * eps) {
            real x1 = (lo + hi - eps) / 2;
            real x2 = (lo + hi + eps) / 2;
            if (f(x1) > f(x2)) {
                lo = x1;
            } else {
                hi = x2;
            }
        }
        return f((lo + hi) / 2);
    };
    
    std::cout << std::fixed << std::setprecision(10);
    std::cout << get([&](real px) {
        return get([&](real py) {
            real ans = 0;
            for (int i = 0; i < 3; i++) {
                ans += (i + 1) * std::hypot(px - x[i], py - y[i]);
            }
            return ans;
        });
    }) << "\n";
    
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3948kb

input:

0 0
0 0
1 0

output:

3.0000000000

result:

ok found '3.0000000', expected '3.0000000', error '0.0000000'

Test #2:

score: 0
Accepted
time: 1ms
memory: 3932kb

input:

3802 -1400
-1785 6079
-1696 4064

output:

11785.2709213287

result:

ok found '11785.2709213', expected '11785.2709213', error '0.0000000'

Test #3:

score: 0
Accepted
time: 1ms
memory: 3992kb

input:

-328 -657
-328 -657
-8676 1661

output:

25991.5380845383

result:

ok found '25991.5380845', expected '25991.5380845', error '0.0000000'

Test #4:

score: -100
Wrong Answer
time: 1ms
memory: 3952kb

input:

1769 3696
-5156 3323
3100 -5945

output:

50763.4990283449

result:

wrong answer 1st numbers differ - expected: '34556.4118182', found: '50763.4990283', error = '0.4690038'