結果

問題 No.616 へんなソート
ユーザー mkawa2mkawa2
提出日時 2020-06-09 19:05:52
言語 PyPy3
(7.3.15)
結果
MLE  
実行時間 -
コード長 1,360 bytes
コンパイル時間 1,242 ms
コンパイル使用メモリ 86,648 KB
実行使用メモリ 845,908 KB
最終ジャッジ日時 2023-08-30 19:02:25
合計ジャッジ時間 8,486 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,084 KB
testcase_01 AC 72 ms
71,096 KB
testcase_02 AC 77 ms
75,200 KB
testcase_03 AC 81 ms
76,164 KB
testcase_04 AC 86 ms
76,100 KB
testcase_05 AC 73 ms
71,308 KB
testcase_06 AC 84 ms
76,116 KB
testcase_07 AC 79 ms
76,000 KB
testcase_08 AC 85 ms
75,932 KB
testcase_09 AC 87 ms
76,012 KB
testcase_10 AC 82 ms
76,192 KB
testcase_11 AC 85 ms
76,124 KB
testcase_12 AC 103 ms
82,512 KB
testcase_13 AC 1,097 ms
476,036 KB
testcase_14 AC 103 ms
82,408 KB
testcase_15 AC 82 ms
76,264 KB
testcase_16 AC 84 ms
76,172 KB
testcase_17 AC 467 ms
286,444 KB
testcase_18 AC 109 ms
82,548 KB
testcase_19 AC 140 ms
105,588 KB
testcase_20 AC 84 ms
75,964 KB
testcase_21 AC 85 ms
75,988 KB
testcase_22 AC 101 ms
85,084 KB
testcase_23 AC 70 ms
71,296 KB
testcase_24 AC 72 ms
70,936 KB
testcase_25 AC 74 ms
71,128 KB
testcase_26 AC 73 ms
70,940 KB
testcase_27 AC 70 ms
71,072 KB
testcase_28 MLE -
testcase_29 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

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

class mint:
    def __init__(self, x):
        self.__x = x % md

    def __repr__(self):
        return str(self.__x)

    def __neg__(self):
        return mint(-self.__x)

    def __add__(self, other):
        if isinstance(other, mint): other = other.__x
        return mint(self.__x + other)

    def __sub__(self, other):
        if isinstance(other, mint): other = other.__x
        return mint(self.__x - other)

    def __rsub__(self, other):
        return mint(other - self.__x)

    def __mul__(self, other):
        if isinstance(other, mint): other = other.__x
        return mint(self.__x * other)

    __radd__ = __add__
    __rmul__ = __mul__

    def __truediv__(self, other):
        if isinstance(other, mint): other = other.__x
        return mint(self.__x * pow(other, md - 2, md))

    def __rtruediv__(self, other):
        return mint(other * pow(self.__x, md - 2, md))

    def __pow__(self, power, modulo=None):
        return mint(pow(self.__x, power, md))

md=10**9+7

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

main()
0