Submission #82683

# Submission time Handle Problem Language Result Execution time Memory
82683 2018-11-01T10:23:42 Z heon Pareto (COCI17_pareto) C++11
80 / 80
128 ms 1636 KB
#include<bits/stdc++.h>

using namespace std;

int main(){
	
	int n;
	cin >> n;
	vector <int> v(n);
	long long sum = 0;
	for(int i = 0; i < n; i++){
		cin >> v[i];
		sum += v[i];
	}
	sort(v.rbegin(), v.rend());
	long long curr = 0;
	double a, b;
	double solb = 0.0, sola = 0.0;
	for(int i = 0; i < n; i++){
		curr += v[i];
		a = (double) (i+1) / n;
		b = (double) curr / sum;
		if(b - a > solb - sola){
			solb = b, sola = a;
		}
	}
	cout << fixed << setprecision(14) << sola * 100 << "\n";
	cout << fixed << setprecision(14) << solb * 100;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 372 KB Output is correct
3 Correct 2 ms 392 KB Output is correct
4 Correct 2 ms 436 KB Output is correct
5 Correct 6 ms 468 KB Output is correct
6 Correct 45 ms 984 KB Output is correct
7 Correct 109 ms 1244 KB Output is correct
8 Correct 128 ms 1636 KB Output is correct