n = int(input())
a = sorted(list(map(int, input().split())))
pairs = [];o = sum(a);e = 0
if o == 0:print(*[100, 0], sep="\n")
else:
for i, item in enumerate(a):
e += item
pairs.append([((i+1)/n * 100), (e/o * 100)])
e = 0
for i, item in enumerate(a[::-1]):
e += item
pairs.append([((i+1)/n * 100), (e/o * 100)])
maximum = float("-inf")
best_pair = None
for pair in pairs:
# print(pair[1]-pair[0])
if pair[1]-pair[0] > maximum:
best_pair = pair
maximum = pair[1]-pair[0]
# print(maximum, best_pair)
print(*best_pair, sep="\n")
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
12 ms |
2772 KB |
Output is correct |
2 |
Correct |
14 ms |
2844 KB |
Output is correct |
3 |
Correct |
12 ms |
2900 KB |
Output is correct |
4 |
Correct |
15 ms |
3176 KB |
Output is correct |
5 |
Correct |
39 ms |
6428 KB |
Output is correct |
6 |
Correct |
325 ms |
38164 KB |
Output is correct |
7 |
Runtime error |
417 ms |
65536 KB |
Execution killed with signal 9 |
8 |
Runtime error |
498 ms |
65536 KB |
Execution killed with signal 9 |