結果
問題 | No.616 へんなソート |
ユーザー | wajima_wataru |
提出日時 | 2017-12-29 11:09:19 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 332 bytes |
コンパイル時間 | 230 ms |
コンパイル使用メモリ | 10,756 KB |
実行使用メモリ | 18,860 KB |
最終ジャッジ日時 | 2023-08-23 08:56:40 |
合計ジャッジ時間 | 6,141 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 16 ms
7,844 KB |
testcase_01 | AC | 15 ms
7,884 KB |
testcase_02 | AC | 15 ms
7,904 KB |
testcase_03 | AC | 19 ms
8,264 KB |
testcase_04 | AC | 35 ms
8,792 KB |
testcase_05 | AC | 15 ms
7,752 KB |
testcase_06 | AC | 29 ms
8,536 KB |
testcase_07 | AC | 17 ms
7,764 KB |
testcase_08 | AC | 38 ms
8,680 KB |
testcase_09 | AC | 70 ms
9,520 KB |
testcase_10 | AC | 20 ms
7,800 KB |
testcase_11 | AC | 41 ms
9,352 KB |
testcase_12 | AC | 408 ms
18,860 KB |
testcase_13 | TLE | - |
testcase_14 | -- | - |
testcase_15 | -- | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
testcase_26 | -- | - |
testcase_27 | -- | - |
testcase_28 | -- | - |
testcase_29 | -- | - |
ソースコード
N, K = map(int, input().split()) A = input() if N == 1: print(1) else: dp = [[0 for i in range(N * (N - 1))] for j in range(N + 1)] dp[1][0] = 1 j_max = 2 for i in range(2, N + 1): for j in range(max(j_max, K + 1)): dp[i][j] = sum(dp[i - 1][max(0, j - i + 1):j + 1]) j_max += i print(sum(dp[N][0:K + 1]) % 1000000007)