QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#469064#5887. Safety in Numbershungt10 14ms3940kbC++141.1kb2024-07-09 12:47:582024-07-09 12:47:58

Judging History

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

  • [2024-07-09 12:47:58]
  • 评测
  • 测评结果:0
  • 用时:14ms
  • 内存:3940kb
  • [2024-07-09 12:47:58]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

#define fastio ios_base::sync_with_stdio(false); cin.tie(0)

const double EPS = 1e-7;

void solve(int tc) {
    cout << "Case #" << tc << ": ";
    
    int n; cin >> n;
    int sum = 0;

    vector<int> s(n);
    for (int &x : s) {
        cin >> x;
        sum += x;
    }

    vector<double> ans(n);
    for (int i = 0; i < n; i++) {
        double left = 0, right = 1;
        double minVal = right;
        for (int it = 0; it < 100; it++) {
            double mid = (left + right) / 2;
            double mean = ((sum - s[i]) + sum * (1 - mid)) / (n - 1);
            double score = s[i] + sum * mid;
            if (score >= mean) {
                minVal = mid;
                right = mid;
            } else {
                left = mid;
            }
        }
        ans[i] = minVal;
    }

    cout << fixed << setprecision(6);
    for (double x : ans) {
        cout << x * 100 << " ";
    }
    cout << '\n';
}


int main()
{
    fastio;
    int T; cin >> T;
    for (int tc = 0; tc < T; tc++){
        solve(tc + 1);
    }
    return 0;
}

詳細信息

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 2ms
memory: 3940kb

input:

20
2 20 10
2 10 0
4 25 25 25 25
3 24 30 21
7 1 54 53 0 1 1 54
10 0 77 0 0 0 0 0 0 0 0
6 80 80 80 80 80 80
2 53 53
7 73 74 73 0 0 1 1
10 100 100 100 100 100 100 100 100 100 100
2 47 0
7 99 1 100 1 1 0 99
6 33 50 37 50 100 40
5 0 1 98 0 97
4 62 11 52 61
7 73 45 60 54 69 48 73
8 55 53 53 76 47 76 77 42...

output:

Case #1: 33.333333 66.666667 
Case #2: 0.000000 100.000000 
Case #3: 25.000000 25.000000 25.000000 25.000000 
Case #4: 34.666667 26.666667 38.666667 
Case #5: 27.961672 0.000000 0.000000 28.571429 27.961672 27.961672 0.000000 
Case #6: 20.000000 0.000000 20.000000 20.000000 20.000000 20.000000 20.00...

result:

wrong answer read 27.961672000000 but expected 24.847560975400 (test case 5)

Subtask #2:

score: 0
Wrong Answer

Test #2:

score: 0
Wrong Answer
time: 14ms
memory: 3940kb

input:

50
174 46 49 48 48 47 47 45 48 49 46 45 47 44 44 50 48 50 45 44 49 50 45 49 47 44 45 49 48 47 48 44 45 49 50 45 46 50 46 48 49 48 46 44 50 49 45 49 44 47 46 46 50 46 49 47 45 47 46 50 44 45 45 49 48 50 46 48 46 49 50 49 49 46 45 50 47 48 44 48 46 46 45 44 46 49 49 44 47 49 48 50 45 46 45 50 45 45 46...

output:

Case #1: 0.590019 0.553536 0.565697 0.565697 0.577858 0.577858 0.602180 0.565697 0.553536 0.590019 0.602180 0.577858 0.614341 0.614341 0.541375 0.565697 0.541375 0.602180 0.614341 0.553536 0.541375 0.602180 0.553536 0.577858 0.614341 0.602180 0.553536 0.565697 0.577858 0.565697 0.614341 0.602180 0.5...

result:

wrong answer read 0.590019000000 but expected 0.589633334900 (test case 1)