Submission #90786

# Submission time Handle Problem Language Result Execution time Memory
90786 2018-12-24T12:31:59 Z BabinSinko Pareto (COCI17_pareto) C++14
50 / 80
1000 ms 5280 KB
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <cctype>

using namespace std;
float r[300003], a, b, m, ma, mb, mon, mmon, n;
int main() {
cin >> n;
for (int i = 0; i < n; i++){
	cin >> r[i];
	mon += r[i];
}
while (m == 0){
	m = 1;
	for(int i = 0; i < (n-1); i++){
		if (r[i] < r[i+1]){
			m = r[i];
			r[i] = r[i + 1];
			r[i+1] = m;
			m = 0;
		}
	}
}
for (int i = 1; i < n + 1; i++){
	mmon += r[i-1]; 
	a = (i * 100) / n;
	b = mmon * 100 / mon;
	if(b - a > mb - ma){
		ma = a;
		mb = b;
	}
}

cout << ma << endl << mb;
  return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 508 KB Output is correct
3 Correct 2 ms 576 KB Output is correct
4 Correct 4 ms 596 KB Output is correct
5 Correct 227 ms 596 KB Output is correct
6 Execution timed out 1075 ms 1568 KB Time limit exceeded
7 Execution timed out 1084 ms 3216 KB Time limit exceeded
8 Execution timed out 1067 ms 5280 KB Time limit exceeded