結果

問題 No.616 へんなソート
ユーザー brthyyjpbrthyyjp
提出日時 2021-12-23 02:04:23
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 291 ms / 2,000 ms
コード長 360 bytes
コンパイル時間 281 ms
コンパイル使用メモリ 81,832 KB
実行使用メモリ 169,948 KB
最終ジャッジ日時 2023-10-16 23:09:42
合計ジャッジ時間 3,763 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
53,544 KB
testcase_01 AC 35 ms
53,544 KB
testcase_02 AC 36 ms
53,544 KB
testcase_03 AC 42 ms
59,916 KB
testcase_04 AC 42 ms
59,920 KB
testcase_05 AC 36 ms
53,544 KB
testcase_06 AC 43 ms
59,916 KB
testcase_07 AC 40 ms
59,784 KB
testcase_08 AC 41 ms
59,916 KB
testcase_09 AC 43 ms
61,968 KB
testcase_10 AC 41 ms
59,784 KB
testcase_11 AC 42 ms
59,920 KB
testcase_12 AC 47 ms
62,004 KB
testcase_13 AC 130 ms
99,824 KB
testcase_14 AC 46 ms
62,004 KB
testcase_15 AC 40 ms
59,784 KB
testcase_16 AC 42 ms
59,920 KB
testcase_17 AC 82 ms
75,792 KB
testcase_18 AC 50 ms
64,052 KB
testcase_19 AC 50 ms
64,052 KB
testcase_20 AC 42 ms
59,916 KB
testcase_21 AC 43 ms
59,920 KB
testcase_22 AC 46 ms
61,968 KB
testcase_23 AC 35 ms
53,544 KB
testcase_24 AC 36 ms
53,544 KB
testcase_25 AC 37 ms
53,544 KB
testcase_26 AC 36 ms
53,544 KB
testcase_27 AC 35 ms
53,544 KB
testcase_28 AC 290 ms
169,948 KB
testcase_29 AC 291 ms
169,948 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, k = map(int, input().split())
A = list(map(int, input().split()))

mod = 10**9+7

dp = [1]*(k+1)
for i in range(n):
    nx = [0]*(k+1)
    for j in range(k+1):
        if j-1-i >= 0:
            nx[j] =dp[j]-dp[j-1-i]
        else:
            nx[j] = dp[j]
    for j in range(1, k+1):
        nx[j] += nx[j-1]
        nx[j] %= mod
    dp = nx
print(dp[k])
0