# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
598005 | chinmoy_101 | Pareto (COCI17_pareto) | C++14 | 163 ms | 6568 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define lb long double
int main()
{
ll n;
lb sum=0;
cin>>n;
lb arr[n];
for(ll i=0; i<n; i++)
{
cin>>arr[i];
sum+=arr[i];
}
sort(arr, arr+n);
reverse(arr, arr+n);
lb cursum=0;
lb a=100.0, b=100.0;
for(ll i=0; i<n; i++)
{
cursum+=arr[i];
lb aa = (i+1)*100/(lb)n;
lb bb = (cursum*100)/sum;
if((bb-aa)>(b-a))
{
a=aa;
b=bb;
}
//cout<<a <<" " <<b <<"\n";
}
cout<<a <<"\n";
cout<<b <<"\n";
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |