QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#501517#2267. Jewelry SizeyzkkaiWA 7ms3880kbC++201.1kb2024-08-02 19:57:322024-08-02 19:57:34

Judging History

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

  • [2024-08-02 19:57:34]
  • 评测
  • 测评结果:WA
  • 用时:7ms
  • 内存:3880kb
  • [2024-08-02 19:57:32]
  • 提交

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-10) {
        ld mid = (l + r) / 2;
        
        ld sum = 0, mx = 0;
        for (int i = 0; i < n; ++i) {
            ld th = 1.0 -  (ld)a[i] * a[i] / 2 / mid / mid;
            if (a[i] + 1e-10 > mid + mid) {
                sum = 1e9;
                break;
            }

            mx = max(mx, acosl(th));
            sum += acosl(th);
        }
    

        if (sum < 2 * M_PI){
            if(mx > sum - mx){
                l  = mid;
                continue;
            }
            r = mid;
        }
        else
            l = mid;
    }

    cout << fixed << setprecision(13) << 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: 3796kb

input:

5
3 1 6 1 7

output:

3.5444043509491

result:

ok found '3.5444044', expected '3.5444044', error '0.0000000'

Test #2:

score: 0
Accepted
time: 0ms
memory: 3836kb

input:

3
500 300 400

output:

250.0000000000567

result:

ok found '250.0000000', expected '250.0000000', error '0.0000000'

Test #3:

score: 0
Accepted
time: 0ms
memory: 3840kb

input:

8
2000 3000 4000 2000 3000 4000 2000 3000

output:

3780.9741205995504

result:

ok found '3780.9741206', expected '3780.9741206', error '0.0000000'

Test #4:

score: 0
Accepted
time: 0ms
memory: 3860kb

input:

10
602 67 67 67 67 67 67 67 67 67

output:

3003.1398169653669

result:

ok found '3003.1398170', expected '3003.1398170', error '0.0000000'

Test #5:

score: -100
Wrong Answer
time: 7ms
memory: 3880kb

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.0000000000000

result:

wrong answer 1st numbers differ - expected: '490696.1297935', found: '100001.0000000', error = '0.7962059'