Submission #703208

#TimeUsernameProblemLanguageResultExecution timeMemory
703208delreyPareto (COCI17_pareto)C++14
80 / 80
93 ms3020 KiB
#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 timeMemoryGrader output
Fetching results...