結果

問題 No.1238 選抜クラス
ユーザー vwxyzvwxyz
提出日時 2023-04-22 07:14:37
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 169 ms / 2,000 ms
コード長 1,038 bytes
コンパイル時間 368 ms
コンパイル使用メモリ 82,560 KB
実行使用メモリ 90,752 KB
最終ジャッジ日時 2024-04-24 13:52:06
合計ジャッジ時間 7,814 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 140 ms
89,856 KB
testcase_01 AC 144 ms
89,728 KB
testcase_02 AC 140 ms
90,432 KB
testcase_03 AC 137 ms
89,856 KB
testcase_04 AC 130 ms
89,600 KB
testcase_05 AC 141 ms
89,856 KB
testcase_06 AC 137 ms
89,472 KB
testcase_07 AC 145 ms
90,240 KB
testcase_08 AC 139 ms
90,112 KB
testcase_09 AC 161 ms
90,496 KB
testcase_10 AC 137 ms
90,344 KB
testcase_11 AC 150 ms
90,368 KB
testcase_12 AC 137 ms
90,624 KB
testcase_13 AC 150 ms
90,496 KB
testcase_14 AC 137 ms
90,368 KB
testcase_15 AC 156 ms
90,368 KB
testcase_16 AC 163 ms
90,412 KB
testcase_17 AC 151 ms
90,240 KB
testcase_18 AC 159 ms
90,240 KB
testcase_19 AC 169 ms
90,240 KB
testcase_20 AC 151 ms
90,392 KB
testcase_21 AC 158 ms
90,368 KB
testcase_22 AC 147 ms
90,388 KB
testcase_23 AC 157 ms
90,240 KB
testcase_24 AC 151 ms
90,496 KB
testcase_25 AC 164 ms
90,240 KB
testcase_26 AC 150 ms
90,368 KB
testcase_27 AC 162 ms
90,752 KB
testcase_28 AC 160 ms
90,368 KB
testcase_29 AC 158 ms
90,496 KB
testcase_30 AC 141 ms
90,752 KB
testcase_31 AC 153 ms
90,368 KB
testcase_32 AC 147 ms
90,368 KB
testcase_33 AC 149 ms
90,240 KB
testcase_34 AC 149 ms
90,240 KB
testcase_35 AC 156 ms
90,368 KB
testcase_36 AC 149 ms
90,368 KB
testcase_37 AC 155 ms
90,368 KB
testcase_38 AC 155 ms
90,452 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import bisect
import copy
import decimal
import fractions
import functools
import heapq
import itertools
import math
import random
import sys
from collections import Counter,deque,defaultdict
from functools import lru_cache,reduce
from heapq import heappush,heappop,heapify,heappushpop,_heappop_max,_heapify_max
def _heappush_max(heap,item):
    heap.append(item)
    heapq._siftdown_max(heap, 0, len(heap)-1)
def _heappushpop_max(heap, item):
    if heap and item < heap[0]:
        item, heap[0] = heap[0], item
        heapq._siftup_max(heap, 0)
    return item
from math import gcd as GCD
read=sys.stdin.read
readline=sys.stdin.readline
readlines=sys.stdin.readlines

N,K=map(int,readline().split())
A=list(map(int,readline().split()))
mod=10**9+7
sum_A=sum(A)
dp=[0]*(100*N+1)
dp[N*K]=1
for a in A:
    a-=K
    prev=dp
    dp=[0]*(100*N+1)
    for i in range(100*N+1):
        if 0<=i+a<100*N+1:
            dp[i+a]+=prev[i]
    for i in range(100*N+1):
        dp[i]+=prev[i]
        dp[i]%=mod
ans=(sum(dp[N*K:])-1)%mod
print(ans)
0