# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
136919 | dnass | Pareto (COCI17_pareto) | C++14 | 166 ms | 4204 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;
typedef long long int lld;
lld n;
lld a[300100];
int main(){
cout.precision(15);
cin >> n;
lld tot_sum = 0;
for(lld i=0;i<n;i++){
cin >> a[i];
tot_sum += a[i];
}
sort(a, a+n); reverse(a, a+n);
lld sum = 0;
double max_dif = -1;
double aa, bb, real_a, real_b;
for(lld i=0;i<n;i++){
sum += a[i];
aa = ((double)(i+1))/((double)n);
bb = ((double)sum)/((double)tot_sum);
if(bb-aa>max_dif){
max_dif = bb-aa;
real_b = bb;
real_a = aa;
}
}
cout << 100*real_a << endl;
cout << 100*real_b << endl;
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |