結果
問題 | No.616 へんなソート |
ユーザー | mkawa2 |
提出日時 | 2020-06-09 19:03:32 |
言語 | PyPy3 (7.3.15) |
結果 |
MLE
|
実行時間 | - |
コード長 | 2,020 bytes |
コンパイル時間 | 863 ms |
コンパイル使用メモリ | 86,936 KB |
実行使用メモリ | 844,380 KB |
最終ジャッジ日時 | 2023-08-30 19:00:35 |
合計ジャッジ時間 | 10,132 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 92 ms
71,544 KB |
testcase_01 | AC | 92 ms
71,244 KB |
testcase_02 | AC | 101 ms
76,280 KB |
testcase_03 | AC | 106 ms
76,964 KB |
testcase_04 | AC | 107 ms
77,308 KB |
testcase_05 | AC | 92 ms
71,544 KB |
testcase_06 | AC | 104 ms
77,084 KB |
testcase_07 | AC | 100 ms
77,148 KB |
testcase_08 | AC | 108 ms
77,172 KB |
testcase_09 | AC | 106 ms
77,356 KB |
testcase_10 | AC | 104 ms
77,096 KB |
testcase_11 | AC | 105 ms
77,276 KB |
testcase_12 | AC | 115 ms
77,592 KB |
testcase_13 | AC | 1,142 ms
485,256 KB |
testcase_14 | AC | 115 ms
77,560 KB |
testcase_15 | AC | 105 ms
77,116 KB |
testcase_16 | AC | 107 ms
77,188 KB |
testcase_17 | AC | 456 ms
287,340 KB |
testcase_18 | AC | 134 ms
89,884 KB |
testcase_19 | AC | 136 ms
90,104 KB |
testcase_20 | AC | 104 ms
77,300 KB |
testcase_21 | AC | 106 ms
77,104 KB |
testcase_22 | AC | 110 ms
77,224 KB |
testcase_23 | AC | 91 ms
71,520 KB |
testcase_24 | AC | 91 ms
71,336 KB |
testcase_25 | AC | 92 ms
71,204 KB |
testcase_26 | AC | 93 ms
72,156 KB |
testcase_27 | AC | 94 ms
72,012 KB |
testcase_28 | MLE | - |
testcase_29 | -- | - |
ソースコード
from operator import itemgetter from itertools import * from bisect import * from collections import * from heapq import * import sys sys.setrecursionlimit(10 ** 6) def II(): return int(sys.stdin.readline()) def MI(): return map(int, sys.stdin.readline().split()) def LI(): return list(map(int, sys.stdin.readline().split())) def SI(): return sys.stdin.readline()[:-1] def LLI(rows_number): return [LI() for _ in range(rows_number)] def LLI1(rows_number): return [LI1() for _ in range(rows_number)] int1 = lambda x: int(x) - 1 def MI1(): return map(int1, sys.stdin.readline().split()) def LI1(): return list(map(int1, sys.stdin.readline().split())) p2D = lambda x: print(*x, sep="\n") dij = [(1, 0), (0, 1), (-1, 0), (0, -1)] 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() LI() 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()