QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#258334 | #2267. Jewelry Size | Fireball0424# | WA | 1ms | 3768kb | C++14 | 1.3kb | 2023-11-19 17:12:35 | 2023-11-19 17:12:36 |
Judging History
answer
#pragma GCC optimizer("Ofast")
#pragma GCC target("avx2")
#include <bits/stdc++.h>
#define int long long
#define ld long double
#define ull unsigned long long
#define fr first
#define fi first
#define sc second
#define se second
#define all(x) x.begin(), x.end()
#define pii pair<int,int>
using namespace std;
#ifndef fireball
#define tofu ios::sync_with_stdio(0); cin.tie(0);
#else
#define tofu freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#endif
void db() {cout << '\n';}
template <typename T, typename ...U> void db(T a, U ...b) {cout << a << ' ', db(b...);}
const ld pi = acos(-1);
signed main(){
tofu;
int n; cin >> n;
ld e[n];
for(int i = 0; i < n; ++i){
cin >> e[i];
e[i] = e[i] * e[i];
}
auto check = [&](ld m){
ld sum = 0.0;
m = m * m * 2;
for(int i = 0; i < n; ++i){
ld th = acos(1.0 - (e[i] / m));
sum += th;
}
//db(m, sum);
return (2 * pi) >= sum;
};
ld l = 0.0, r = 10000000.0, ans = 10000000.0;
int cnt = 100;
while(cnt--){
ld m = (l + r) / 2.0;
if(check(m)){
ans = m;
r = m;
}
else l = m;
}
cout << fixed << setprecision(10) << ans << endl;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3572kb
input:
5 3 1 6 1 7
output:
3.5444043509
result:
ok found '3.5444044', expected '3.5444044', error '0.0000000'
Test #2:
score: 0
Accepted
time: 1ms
memory: 3656kb
input:
3 500 300 400
output:
250.0000000000
result:
ok found '250.0000000', expected '250.0000000', error '0.0000000'
Test #3:
score: 0
Accepted
time: 1ms
memory: 3768kb
input:
8 2000 3000 4000 2000 3000 4000 2000 3000
output:
3780.9741205995
result:
ok found '3780.9741206', expected '3780.9741206', error '0.0000000'
Test #4:
score: -100
Wrong Answer
time: 1ms
memory: 3712kb
input:
10 602 67 67 67 67 67 67 67 67 67
output:
301.0000000000
result:
wrong answer 1st numbers differ - expected: '3003.1398170', found: '301.0000000', error = '0.8997716'