QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#94524 | #2267. Jewelry Size | whatever# | WA | 0ms | 3908kb | C++23 | 1.1kb | 2023-04-06 15:40:30 | 2023-04-06 15:40:32 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false), cin.tie(0);
int n; cin >> n;
vector<int> len(n);
for(auto &x : len) cin >> x;
sort(len.begin(), len.end());
constexpr double PI = acos(-1), eps = 1e-8;
double ans = 1e18;
cout << fixed << setprecision(10);
{
auto check = [&] (double r) {
double sum = 0;
for(int i = 0; i < n; i ++) {
sum += 2 * asin(len[i] / 2.0 / r);
}
return sum > 2 * PI - eps;
};
double l = len.back() / 2.0, r = 1e18;
for(int i = 0; i < 140; i ++) {
double mid = (l + r) / 2;
if(check(mid)) l = mid;
else r = mid;
}
if(check(l)) ans = min(ans, l);
}
{
auto check = [&] (double r) {
double sum = 0;
for(int i = 0; i < n; i ++) {
sum += 2 * asin(len[i] / 2.0 / r);
}
return sum < 4 * asin(len.back() / 2.0 / r) ;
};
double l = len.back() / 2.0, r = 1e18;
for(int i = 0; i < 140; i ++) {
double mid = (l + r) / 2;
if(check(mid)) l = mid;
else r = mid;
}
cout << l << ' ' << r << endl;
if(check(l)) ans = min(ans, l);
}
cout << ans << '\n';
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3908kb
input:
5 3 1 6 1 7
output:
3.5000000000 3.5000000000 3.5444043530
result:
wrong answer 1st numbers differ - expected: '3.5444044', found: '3.5000000', error = '0.0125280'