結果

問題 No.616 へんなソート
ユーザー mkawa2mkawa2
提出日時 2020-06-09 19:07:37
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 452 ms / 2,000 ms
コード長 424 bytes
コンパイル時間 1,122 ms
コンパイル使用メモリ 86,388 KB
実行使用メモリ 181,720 KB
最終ジャッジ日時 2023-08-30 19:03:22
合計ジャッジ時間 5,495 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,176 KB
testcase_01 AC 71 ms
71,196 KB
testcase_02 AC 70 ms
71,048 KB
testcase_03 AC 75 ms
75,212 KB
testcase_04 AC 76 ms
75,400 KB
testcase_05 AC 73 ms
70,820 KB
testcase_06 AC 75 ms
75,532 KB
testcase_07 AC 73 ms
75,380 KB
testcase_08 AC 76 ms
75,480 KB
testcase_09 AC 79 ms
75,524 KB
testcase_10 AC 74 ms
75,708 KB
testcase_11 AC 76 ms
75,460 KB
testcase_12 AC 78 ms
75,544 KB
testcase_13 AC 203 ms
111,420 KB
testcase_14 AC 78 ms
75,500 KB
testcase_15 AC 73 ms
75,380 KB
testcase_16 AC 77 ms
75,888 KB
testcase_17 AC 146 ms
92,580 KB
testcase_18 AC 82 ms
75,640 KB
testcase_19 AC 85 ms
75,228 KB
testcase_20 AC 73 ms
75,708 KB
testcase_21 AC 74 ms
75,224 KB
testcase_22 AC 78 ms
75,396 KB
testcase_23 AC 70 ms
71,028 KB
testcase_24 AC 70 ms
71,196 KB
testcase_25 AC 68 ms
70,988 KB
testcase_26 AC 71 ms
71,124 KB
testcase_27 AC 71 ms
71,004 KB
testcase_28 AC 452 ms
181,720 KB
testcase_29 AC 441 ms
181,716 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

sys.setrecursionlimit(10 ** 6)

def MI(): return map(int, sys.stdin.readline().split())

def main():
    md = 10 ** 9 + 7
    n,k=MI()
    MI()
    dp=[[0]*(k+1) for _ in range(n+1)]
    dp[0][0]=1
    for i in range(n):
        s=0
        w=n-i
        for j in range(k+1):
            s+=dp[i][j]
            if j-w>=0:s-=dp[i][j-w]
            s%=md
            dp[i+1][j]=s
    print(sum(dp[n])%md)

main()
0