# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
100733 | dalgerok | Pareto (COCI17_pareto) | C++17 | 57 ms | 3064 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;
const int N = 3e5 + 5;
int n, a[N];
long long sum1, sum2;
long double ans, ans1, ans2;
int main(){
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
cin >> n;
for(int i = 1; i <= n; i++){
cin >> a[i];
sum1 += a[i];
}
sort(a + 1, a + n + 1);
reverse(a + 1, a + n + 1);
for(int i = 1; i <= n; i++){
sum2 += a[i];
long double cur1 = (i / (long double)n) * 100,
cur2 = (sum2 / (long double)sum1) * 100;
if(cur2 - cur1 > ans){
ans = cur2 - cur1;
ans1 = cur1;
ans2 = cur2;
}
}
cout << fixed << setprecision(10) << ans1 << "\n" << ans2;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |