답안 #597437

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
597437 2022-07-16T03:17:46 Z KK_1729 Pareto (COCI17_pareto) Python 3
60 / 80
439 ms 65536 KB
n = int(input())
a = sorted(list(map(int, input().split())))
pairs = [];o = sum(a);e = 0
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 14 ms 2772 KB Output is correct
2 Correct 13 ms 2872 KB Output is correct
3 Correct 14 ms 2856 KB Output is correct
4 Correct 15 ms 3132 KB Output is correct
5 Correct 34 ms 6568 KB Output is correct
6 Correct 270 ms 38936 KB Output is correct
7 Runtime error 427 ms 65536 KB Execution killed with signal 9
8 Runtime error 439 ms 65536 KB Execution killed with signal 9