Submission #100733

#TimeUsernameProblemLanguageResultExecution timeMemory
100733dalgerokPareto (COCI17_pareto)C++17
80 / 80
57 ms3064 KiB
#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 timeMemoryGrader output
Fetching results...