#include "bits/stdc++.h"
using namespace std;
#define intt long long
#define fi first
#define se second
const intt mxN = 1e5+1;
const intt LG = 20;
const intt inf = 1e18;
intt n, k;
double sum, tsum;
vector<double> a(mxN);
void _() {
cin >> n;
a.resize(n);
for(intt i = 0; i < n; i++) {
cin >> a[i]; tsum += a[i];
}
sort(a.begin(), a.end());
reverse(a.begin(), a.end());
double l = 0, ans1 = 0, ans2 = 0;
for(intt i = 0; i < n; i++) {
sum += a[i];
if(l < sum*100/tsum - (i+1)*100/n) {
ans1 = (i+1)*100/n;
ans2 = sum*100/tsum;
l = sum*100/tsum - (i+1)*100/n;
}
}
cout << ans1 << endl << ans2;
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
// freopen("checklist.in", "r", stdin);
// freopen("checklist.out", "w", stdout);
intt t = 1, buu = 1;
// cin >> t;
while(t--){
// cout << "Case #" << buu++ << ": ";
_();
}
}
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |