# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
596234 | hail | Pareto (COCI17_pareto) | C++17 | 45 ms | 4160 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;
using ll=long long;
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
int n; cin>>n;
vector<ll> money_arr(n);
cout<<setprecision(20);
long long total_money{};
for(int i=0; i<n; i++)
{
cin>>money_arr[i];
total_money+=money_arr[i];
}
double perc_ppl;
double perc_money;
double ppl;
double money;
double max_d{};
double money_sum{};
sort(money_arr.rbegin(), money_arr.rend());
for(int i=1; i<=n; i++)
{
money_sum+=money_arr[i-1];
perc_ppl = (i/((double)n));
perc_money = money_sum/((double)total_money);
if(abs(perc_money-perc_ppl)>max_d)
{
max_d = abs(perc_money-perc_ppl);
money = perc_money;
ppl = perc_ppl;
}
}
cout<<(ppl*100)<<"\n"<<(money*100);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |