Submission #597443

#TimeUsernameProblemLanguageResultExecution timeMemory
597443KK_1729Pareto (COCI17_pareto)Cpython 3
60 / 80
498 ms65536 KiB
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")
#Verdict Execution timeMemoryGrader output
Fetching results...