結果
問題 |
No.21 平均の差
|
ユーザー |
|
提出日時 | 2021-02-10 11:14:36 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 650 bytes |
コンパイル時間 | 324 ms |
コンパイル使用メモリ | 82,316 KB |
実行使用メモリ | 76,852 KB |
最終ジャッジ日時 | 2024-07-07 21:18:53 |
合計ジャッジ時間 | 1,498 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 9 WA * 1 |
ソースコード
import itertools import sys import copy import math N = int(input()) K = int(input()) lsn = [int(input()) for i in range(N)] if N==K: print(max(lsn)-min(lsn)) sys.exit() lsp = itertools.combinations_with_replacement(range(K),N) ans = 0 for p in lsp: lsg2 = [[] for i in range(K)] for i in range(N): lsg2[p[i]].append(lsn[i]) maxa = 0 mina = 10000 f = True for i in range(K): if len(lsg2[i]) == 0: f= False break maxa = max(maxa,sum(lsg2[i])/len(lsg2[i])) mina = min(mina,sum(lsg2[i])/len(lsg2[i])) if f: ans = max(ans,math.ceil(maxa-mina)) print(ans)