結果

問題 No.21 平均の差
ユーザー tnodinotnodino
提出日時 2022-02-12 15:53:29
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 700 bytes
コンパイル時間 98 ms
コンパイル使用メモリ 10,904 KB
実行使用メモリ 12,576 KB
最終ジャッジ日時 2023-09-11 03:30:58
合計ジャッジ時間 7,238 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

from itertools import permutations
N = int(input())
K = int(input())
n = list(int(input()) for _ in range(N))
L = [i for i in range(N)]
ans = 0
for A in range(1,N+1):
    for B in range(1,N+1):
        if N - A - B < K - 2:
            continue
        for X in permutations(L, A):
            for Y in permutations(L, B):
                flg = True
                for x in X:
                    if x in Y:
                        flg = False
                        break
                if flg:
                    P = sum([n[i] for i in X]) / len(X)
                    Q = sum([n[i] for i in Y]) / len(Y)
                    R = int(P - Q + 0.9)
                    ans = max(ans, R)
print(ans)
0