結果

問題 No.21 平均の差
ユーザー tnodinotnodino
提出日時 2022-02-08 06:44:37
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 512 bytes
コンパイル時間 672 ms
コンパイル使用メモリ 86,604 KB
実行使用メモリ 77,704 KB
最終ジャッジ日時 2023-09-05 03:12:01
合計ジャッジ時間 8,149 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 79 ms
75,948 KB
testcase_01 AC 158 ms
77,704 KB
testcase_02 AC 329 ms
77,568 KB
testcase_03 AC 72 ms
71,236 KB
testcase_04 TLE -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
K = int(input())
n = list(int(input()) for _ in range(N))
ans = 0
for bit in range(K**N):
    x = bit
    Group = [[] for _ in range(K)]
    for i in range(N):
        Group[x%K].append(n[i])
        x //= K
    flg = False
    for i in range(K):
        if not Group[i]:
            flg = True
    if flg:
        continue
    Set = []
    for i in range(K):
        Set.append(sum(Group[i]) / len(Group[i]))
    Ma = max(Set)
    Mi = min(Set)
    ans = max(ans, int(Ma - Mi + 0.5))
print(ans)
0