結果

問題 No.21 平均の差
ユーザー zakuro9715zakuro9715
提出日時 2015-10-08 00:14:33
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 490 bytes
コンパイル時間 324 ms
コンパイル使用メモリ 86,872 KB
実行使用メモリ 71,636 KB
最終ジャッジ日時 2023-09-27 07:53:45
合計ジャッジ時間 1,902 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import combinations

N, K = int(input()), int(input())
s = list(sorted([int(input()) for i in range(N)]))

ans = 0

for x in combinations(range(1, N), K - 1):
    mx, mn = 0, 10000000000
    x = [0] + list(x) + [N]
    for k in range(1, K + 1):
        print(x[k - 1], x[k])
        x1, x2 = x[k - 1], x[k]
        sss = sum(s[x1:x2]) / (x2 - x1)
        mx = max(sss, mx)
        mn = min(sss, mn)
    ans = max(ans, mx - mn)
print(int(ans) + (1 if int(ans) != ans else 0))
0