結果

問題 No.21 平均の差
ユーザー tnodinotnodino
提出日時 2022-02-08 06:44:04
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 512 bytes
コンパイル時間 423 ms
コンパイル使用メモリ 10,944 KB
実行使用メモリ 16,124 KB
最終ジャッジ日時 2023-09-05 03:11:24
合計ジャッジ時間 9,282 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 18 ms
16,124 KB
testcase_01 AC 412 ms
7,872 KB
testcase_02 AC 1,779 ms
7,912 KB
testcase_03 AC 16 ms
7,768 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