結果
| 問題 |
No.21 平均の差
|
| コンテスト | |
| ユーザー |
sue_charo
|
| 提出日時 | 2017-08-12 01:15:59 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 882 bytes |
| コンパイル時間 | 217 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 10,752 KB |
| 最終ジャッジ日時 | 2024-10-12 22:49:21 |
| 合計ジャッジ時間 | 1,348 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 6 WA * 4 |
ソースコード
# coding: utf-8
from itertools import combinations
import math
def II(): return int(input())
def ILI(): return list(map(int, input().split()))
N = II()
K = II()
n = [II() for __ in range(N)]
sum_n = sum(n)
s_n = set(n)
ans = -1
for i in range(1, N - 2):
for comb_1 in combinations(n, i):
s_comb_1 = set(comb_1)
sum_comb_1 = sum(comb_1)
ave_comb_1 = sum_comb_1 / i
s_others = s_n - s_comb_1
for j in range(1, N - i - 2):
for comb_2 in combinations(s_others, j):
sum_comb_2 = sum(comb_2)
ave_comb_2 = sum_comb_2 / j
sum_comb_3 = sum_n - sum_comb_1 - sum_comb_2
ave_comb_3 = sum_comb_3 / (N - i - j)
dif = math.floor(max(ave_comb_1, ave_comb_2, ave_comb_3) - min(ave_comb_1, ave_comb_2, ave_comb_3))
ans = max(ans, dif)
print(ans)
sue_charo