結果

問題 No.1238 選抜クラス
ユーザー McGregorshMcGregorsh
提出日時 2023-07-14 12:19:42
言語 PyPy3
(7.3.15)
結果
MLE  
実行時間 -
コード長 1,776 bytes
コンパイル時間 780 ms
コンパイル使用メモリ 86,816 KB
実行使用メモリ 848,240 KB
最終ジャッジ日時 2023-10-14 01:46:42
合計ジャッジ時間 9,350 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 238 ms
90,324 KB
testcase_01 AC 243 ms
90,440 KB
testcase_02 AC 283 ms
98,360 KB
testcase_03 AC 240 ms
90,360 KB
testcase_04 AC 240 ms
90,132 KB
testcase_05 AC 242 ms
90,272 KB
testcase_06 AC 237 ms
90,404 KB
testcase_07 AC 254 ms
90,188 KB
testcase_08 AC 275 ms
98,624 KB
testcase_09 AC 320 ms
104,084 KB
testcase_10 AC 260 ms
90,464 KB
testcase_11 AC 312 ms
104,364 KB
testcase_12 AC 282 ms
100,272 KB
testcase_13 AC 281 ms
100,428 KB
testcase_14 AC 276 ms
98,368 KB
testcase_15 AC 321 ms
104,256 KB
testcase_16 AC 312 ms
104,392 KB
testcase_17 MLE -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from sys import stdin
from fractions import Fraction
import math
from math import ceil, floor, sqrt, pi, factorial, gcd
from copy import deepcopy
from collections import Counter, deque, defaultdict
from heapq import heapify, heappop, heappush
from itertools import accumulate, product, combinations, combinations_with_replacement, permutations
from bisect import bisect, bisect_left, bisect_right
from functools import reduce, lru_cache
from decimal import Decimal, getcontext, ROUND_HALF_UP
def i_input(): return int(stdin.readline())
def i_map(): return map(int, stdin.readline().split())
def i_list(): return list(i_map())
def s_input(): return stdin.readline()[:-1]
def s_map(): return s_input().split()
def s_list(): return list(s_map())
def lcm(a, b): return a * b // gcd(a, b)
def get_distance(x1, y1, x2, y2):
	  d = sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2)
	  return d
def rotate(table):
   	  n_fild = []
   	  for x in zip(*table[::-1]):
   	  	  n_fild.append(x)
   	  return n_fild
sys.setrecursionlimit(10 ** 7)
INF = float('inf')
MOD = 10 ** 9 + 7
MOD2 = 998244353
alpa = 'abcdefghijklmnopqrstuvwxyz'
ALPA = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'


def main():
   
   N, K = i_map()
   A = i_list()
   
   dp = [[[0] * 10001 for i in range(N+1)] for i in range(N+1)]
   dp[0][0][0] = 1
   
   for i in range(N):
   	  for j in range(N+1):
   	  	  for k in range(10001):
   	  	  	  if j + 1 <= N:
   	  	  	  	  dp[i+1][j+1][min(10000, k+A[i])] += dp[i][j][k]
   	  	  	  	  dp[i+1][j+1][min(10000, k+A[i])] %= MOD
   	  	  	  dp[i+1][j][k] += dp[i][j][k]
   	  	  	  dp[i+1][j][k] %= MOD
   
   ans = 0
   for i in range(N):
   	  score = sum(dp[-1][i+1][K*(i+1):])
   	  ans += score
   	  ans %= MOD
   print(ans)
   
if __name__ == '__main__':
    main()



0