Submission #1174028

#TimeUsernameProblemLanguageResultExecution timeMemory
1174028NomioPareto (COCI17_pareto)C++20
80 / 80
53 ms2628 KiB
#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; double a[n], S = 0; for(int i = 0; i < n; i++) { cin >> a[i]; S += a[i]; } sort(a, a + n); reverse(a, a + n); double mx = -1e9, s = 0, aa, bb; for(int i = 0; i < n; i++) { double A = (1.0 * (i + 1)) / n; s += a[i]; double B = 1.0 * s / S; if(B - A > mx) { mx = B - A; aa = A; bb = B; } } cout << aa * 100 << '\n' << bb * 100 << '\n'; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...