Submission #703208

# Submission time Handle Problem Language Result Execution time Memory
703208 2023-02-26T14:41:22 Z delrey Pareto (COCI17_pareto) C++14
80 / 80
93 ms 3020 KB
#include <bits/stdc++.h>

using namespace std;

int n, acc[300000];

int main()
{
    long long sum = 0;
    cin>>n;
    for(int i = 0; i < n; i++)
    {
        cin>>acc[i];
        sum += acc[i];
    }
    sort(acc, acc + n);
    double a = 100, b = -1;
    long long sumx = 0;
    for(int i = n - 1; i >= 0; i--)
    {
        double x = (n - i);
        x /= (double)n / 100;
        sumx += acc[i];
        double y = sumx;
        y /= (double)sum / 100;
        if(b - a < y - x)
        {
            a = x;
            b = y;
        }
        //cout<<x<<" "<<y<<endl;
    }
    cout<<a<<endl<<b<<endl;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 220 KB Output is correct
2 Correct 0 ms 312 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 4 ms 384 KB Output is correct
6 Correct 29 ms 1168 KB Output is correct
7 Correct 65 ms 2264 KB Output is correct
8 Correct 93 ms 3020 KB Output is correct