# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
237303 | marlicu | Pareto (COCI17_pareto) | C++14 | 119 ms | 4344 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;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
int n;
cin >> n;
vector <double> klijenti;
klijenti.resize(n);
double ukupno = 0;
for (int i = 0; i < n; i++) {
cin >> klijenti[i];
ukupno += klijenti[i];
}
sort(klijenti.begin(), klijenti.end());
reverse(klijenti.begin(), klijenti.end());
double a = 100, b = 100;
double a1, b1, koliko = 0;
for (int i = 0; i < n; i++) {
koliko += klijenti[i];
a1 = (i + 1) / (double) n * 100;
b1 = koliko / ukupno * 100;
if ((b1 - a1) > (b - a)) {
a = a1; b = b1;
}
//cout << i << " " << koliko << " " << ukupno << " : ";
//cout << a1 << " " << b1 << '\n';
}
cout << a << '\n';
cout << b << '\n';
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |