QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#501350#2267. Jewelry Sizeyzkkai#WA 0ms3844kbC++201.1kb2024-08-02 17:03:262024-08-02 17:03:26

Judging History

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

  • [2024-08-02 17:03:26]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3844kb
  • [2024-08-02 17:03:26]
  • 提交

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-7) {
        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-7) {
                sum = 1e9;
                break;
            }

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

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

    cout << setprecision(13) << r << '\n';
}

signed main() {
    cin.tie(0)->sync_with_stdio(0);
    int t = 1;
    while (t--)
        solve();
    return 0;
}

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3788kb

input:

5
3 1 6 1 7

output:

3.544404417652

result:

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

Test #2:

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

input:

3
500 300 400

output:

250.0000000069

result:

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

Test #3:

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

input:

8
2000 3000 4000 2000 3000 4000 2000 3000

output:

3780.974064497

result:

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

Test #4:

score: -100
Wrong Answer
time: 0ms
memory: 3792kb

input:

10
602 67 67 67 67 67 67 67 67 67

output:

3003.588858227

result:

wrong answer 1st numbers differ - expected: '3003.1398170', found: '3003.5888582', error = '0.0001495'