QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#501344 | #2267. Jewelry Size | yzkkai# | WA | 5ms | 3932kb | C++20 | 1.1kb | 2024-08-02 17:00:59 | 2024-08-02 17:00:59 |
Judging History
answer
#include <bits/stdc++.h>
#define sz(x) signed(size(x))
using namespace std;
using ll = long long;
using LL = long long;
using ld = long double;
inline void solve() {
int n;
cin >> n;
vector<int> a(n);
for (int& i : a)
cin >> i;
ld l = 0, r = 100001;
while (r - l > 1e-6) {
ld mid = (l + r) / 2;
ld sum = 0, mx = 0;
for (int i = 0; i < n; ++i) {
ld th = 1.0 - 1.0 * a[i] * a[i] / (2 * mid * mid);
if (a[i] > mid + mid + 1e-6) {
sum = 1e9;
break;
}
mx = max(mx, acos(th));
sum += acos(th);
}
if (sum < 2 * M_PI){
if(mx > sum - mx){
l = mid;
continue;
}
r = mid;
}
else
l = mid;
}
cout << setprecision(10) << r << '\n';
}
signed main() {
cin.tie(0)->sync_with_stdio(0);
int t = 1;
while (t--)
solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3848kb
input:
5 3 1 6 1 7
output:
3.544404691
result:
ok found '3.5444047', expected '3.5444044', error '0.0000001'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3788kb
input:
3 500 300 400
output:
250.0000002
result:
ok found '250.0000002', expected '250.0000000', error '0.0000000'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3788kb
input:
8 2000 3000 4000 2000 3000 4000 2000 3000
output:
3780.974121
result:
ok found '3780.9741210', expected '3780.9741206', error '0.0000000'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3792kb
input:
10 602 67 67 67 67 67 67 67 67 67
output:
3003.139817
result:
ok found '3003.1398170', expected '3003.1398170', error '0.0000000'
Test #5:
score: -100
Wrong Answer
time: 5ms
memory: 3932kb
input:
1000 4719 3755 2542 1190 5557 3641 5426 1578 5247 3181 3524 983 4151 4337 3004 2062 1048 4739 499 2530 1378 450 5459 651 1714 4051 416 4186 2598 1031 374 5523 4787 1122 4919 2549 4763 4345 2333 4009 5732 5857 3198 3882 2399 4409 4151 3447 1353 4650 4184 2731 3307 3642 3383 5021 5899 2005 3206 702 30...
output:
100001
result:
wrong answer 1st numbers differ - expected: '490696.1297935', found: '100001.0000000', error = '0.7962059'