Submission #82678

#TimeUsernameProblemLanguageResultExecution timeMemory
82678heonPareto (COCI17_pareto)C++11
30 / 80
63 ms1700 KiB
#include<bits/stdc++.h> using namespace std; int main(){ ios_base::sync_with_stdio(false); cin.tie(0); int n; cin >> n; vector <int> v(n); int sum = 0; for(int i = 0; i < n; i++){ cin >> v[i]; sum += v[i]; } sort(v.rbegin(), v.rend()); int curr = 0; double a, b; double mx = -1.0, solb, sola; for(int i = 0; i < n; i++){ curr += v[i]; a = (double) (i+1) / n * 100.0; b = (double) curr / sum * 100.0; if(b - a > mx){ solb = b, sola = a; mx = b - a; } } cout << fixed << setprecision(10) << sola << "\n"; cout << fixed << setprecision(10) << solb; }
#Verdict Execution timeMemoryGrader output
Fetching results...