結果

問題 No.1238 選抜クラス
ユーザー McGregorshMcGregorsh
提出日時 2023-07-14 12:32:51
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 868 ms / 2,000 ms
コード長 1,737 bytes
コンパイル時間 434 ms
コンパイル使用メモリ 86,900 KB
実行使用メモリ 201,460 KB
最終ジャッジ日時 2023-10-14 01:58:54
合計ジャッジ時間 21,069 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 241 ms
89,880 KB
testcase_01 AC 238 ms
89,688 KB
testcase_02 AC 242 ms
90,000 KB
testcase_03 AC 238 ms
89,676 KB
testcase_04 AC 236 ms
89,800 KB
testcase_05 AC 236 ms
89,800 KB
testcase_06 AC 240 ms
89,692 KB
testcase_07 AC 241 ms
90,308 KB
testcase_08 AC 243 ms
90,176 KB
testcase_09 AC 249 ms
90,260 KB
testcase_10 AC 250 ms
90,160 KB
testcase_11 AC 246 ms
90,324 KB
testcase_12 AC 245 ms
90,236 KB
testcase_13 AC 243 ms
90,092 KB
testcase_14 AC 243 ms
90,312 KB
testcase_15 AC 247 ms
90,296 KB
testcase_16 AC 250 ms
90,088 KB
testcase_17 AC 868 ms
201,328 KB
testcase_18 AC 790 ms
185,720 KB
testcase_19 AC 811 ms
185,736 KB
testcase_20 AC 753 ms
169,840 KB
testcase_21 AC 708 ms
160,284 KB
testcase_22 AC 861 ms
201,452 KB
testcase_23 AC 854 ms
201,372 KB
testcase_24 AC 856 ms
201,212 KB
testcase_25 AC 849 ms
201,208 KB
testcase_26 AC 853 ms
201,440 KB
testcase_27 AC 857 ms
201,184 KB
testcase_28 AC 852 ms
201,460 KB
testcase_29 AC 813 ms
185,920 KB
testcase_30 AC 263 ms
90,712 KB
testcase_31 AC 339 ms
95,752 KB
testcase_32 AC 512 ms
122,752 KB
testcase_33 AC 242 ms
90,284 KB
testcase_34 AC 603 ms
137,276 KB
testcase_35 AC 282 ms
92,052 KB
testcase_36 AC 251 ms
90,332 KB
testcase_37 AC 263 ms
90,368 KB
testcase_38 AC 751 ms
170,064 KB
権限があれば一括ダウンロードができます

ソースコード

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 = [[1]]
   
   for i in range(N):
   	  P = (i+1) * 100 + 1
   	  ndp = [[0] * P for i in range(i+2)]
   	  for j, nums in enumerate(dp):
   	  	  for k, point in enumerate(nums):
   	  	  	  ndp[j+1][k+A[i]] += point
   	  	  	  ndp[j+1][k+A[i]] %= MOD
   	  	  	  ndp[j][k] += point
   	  	  	  ndp[j][k] %= MOD
   	  dp = ndp
   	  #print(dp)
   
   ans = 0
   for i in range(N):
   	  score = sum(dp[i+1][K*(i+1):])
   	  ans += score
   	  ans %= MOD
   print(ans)
   
   
if __name__ == '__main__':
    main()



0