結果
問題 | No.615 集合に分けよう |
ユーザー | tktk_snsn |
提出日時 | 2021-08-08 20:42:43 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 336 bytes |
コンパイル時間 | 82 ms |
コンパイル使用メモリ | 11,896 KB |
実行使用メモリ | 20,124 KB |
最終ジャッジ日時 | 2023-10-19 21:20:44 |
合計ジャッジ時間 | 5,007 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 29 ms
14,456 KB |
testcase_01 | AC | 31 ms
10,108 KB |
testcase_02 | AC | 28 ms
10,108 KB |
testcase_03 | AC | 29 ms
10,108 KB |
testcase_04 | AC | 30 ms
10,108 KB |
testcase_05 | AC | 30 ms
10,108 KB |
testcase_06 | AC | 28 ms
10,108 KB |
testcase_07 | AC | 29 ms
10,116 KB |
testcase_08 | AC | 28 ms
10,116 KB |
testcase_09 | AC | 30 ms
10,116 KB |
testcase_10 | AC | 29 ms
10,108 KB |
testcase_11 | AC | 30 ms
10,108 KB |
testcase_12 | AC | 31 ms
10,112 KB |
testcase_13 | AC | 33 ms
10,172 KB |
testcase_14 | AC | 55 ms
10,252 KB |
testcase_15 | AC | 37 ms
11,232 KB |
testcase_16 | AC | 125 ms
15,720 KB |
testcase_17 | AC | 76 ms
15,720 KB |
testcase_18 | AC | 276 ms
15,720 KB |
testcase_19 | TLE | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
testcase_26 | -- | - |
testcase_27 | -- | - |
testcase_28 | -- | - |
testcase_29 | -- | - |
testcase_30 | -- | - |
ソースコード
n, k = map(int, input().split()) A = sorted(map(int, input().split())) m = n - k + 1 dp = [0] * m for i in range(m): dp[i] = A[i] - A[0] for i in range(1, k): for j in range(m): dp[j] -= A[i+j] for j in range(1, m): dp[j] = min(dp[j], dp[j-1]) for j in range(m): dp[j] += A[i+j] print(dp[m-1])