QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#179993 | #7127. 3 points | ucup-team004 | WA | 1ms | 4028kb | C++20 | 1.0kb | 2023-09-15 14:17:52 | 2023-09-15 14:17:52 |
Judging History
answer
#include <bits/stdc++.h>
using i64 = long long;
using real = long double;
constexpr real eps = 1E-8;
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: 4020kb
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: 3812kb
input:
3802 -1400 -1785 6079 -1696 4064
output:
11785.2709213388
result:
ok found '11785.2709213', expected '11785.2709213', error '0.0000000'
Test #3:
score: 0
Accepted
time: 1ms
memory: 4028kb
input:
-328 -657 -328 -657 -8676 1661
output:
25991.5380845382
result:
ok found '25991.5380845', expected '25991.5380845', error '0.0000000'
Test #4:
score: 0
Accepted
time: 1ms
memory: 3964kb
input:
1769 3696 -5156 3323 3100 -5945
output:
34556.4118182479
result:
ok found '34556.4118182', expected '34556.4118182', error '0.0000000'
Test #5:
score: 0
Accepted
time: 1ms
memory: 3960kb
input:
-3471 -9470 2703 -7464 -7061 -5800
output:
24943.4593375748
result:
ok found '24943.4593376', expected '24943.4593376', error '0.0000000'
Test #6:
score: 0
Accepted
time: 0ms
memory: 3736kb
input:
-7519 -3395 8301 1749 9545 -7037
output:
35195.5937017799
result:
ok found '35195.5937018', expected '35195.5937018', error '0.0000000'
Test #7:
score: 0
Accepted
time: 1ms
memory: 3968kb
input:
-3840 -9039 -5120 -3251 -5120 -3251
output:
5927.8448023252
result:
ok found '5927.8448023', expected '5927.8448023', error '0.0000000'
Test #8:
score: 0
Accepted
time: 1ms
memory: 3724kb
input:
-3303 200 -2722 6597 6508 -1021
output:
33822.1680442481
result:
ok found '33822.1680442', expected '33822.1680442', error '0.0000000'
Test #9:
score: -100
Wrong Answer
time: 1ms
memory: 3968kb
input:
5126 943 5126 943 5031 6532
output:
16794.1408049843
result:
wrong answer 1st numbers differ - expected: '16769.4219936', found: '16794.1408050', error = '0.0014740'