結果

問題 No.1238 選抜クラス
ユーザー mkawa2mkawa2
提出日時 2021-09-02 00:12:33
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 115 ms / 2,000 ms
コード長 971 bytes
コンパイル時間 280 ms
コンパイル使用メモリ 86,940 KB
実行使用メモリ 76,904 KB
最終ジャッジ日時 2023-08-19 07:07:15
合計ジャッジ時間 5,947 ms
ジャッジサーバーID
(参考情報)
judge9 / judge10
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 82 ms
76,488 KB
testcase_01 AC 83 ms
76,464 KB
testcase_02 AC 88 ms
76,480 KB
testcase_03 AC 83 ms
76,248 KB
testcase_04 AC 80 ms
76,268 KB
testcase_05 AC 81 ms
76,256 KB
testcase_06 AC 79 ms
76,248 KB
testcase_07 AC 88 ms
76,332 KB
testcase_08 AC 86 ms
76,504 KB
testcase_09 AC 92 ms
76,564 KB
testcase_10 AC 86 ms
76,540 KB
testcase_11 AC 90 ms
76,640 KB
testcase_12 AC 88 ms
76,304 KB
testcase_13 AC 93 ms
76,420 KB
testcase_14 AC 84 ms
76,452 KB
testcase_15 AC 87 ms
76,284 KB
testcase_16 AC 88 ms
76,424 KB
testcase_17 AC 108 ms
76,504 KB
testcase_18 AC 107 ms
76,484 KB
testcase_19 AC 115 ms
76,904 KB
testcase_20 AC 106 ms
76,536 KB
testcase_21 AC 110 ms
76,624 KB
testcase_22 AC 92 ms
76,508 KB
testcase_23 AC 98 ms
76,416 KB
testcase_24 AC 98 ms
76,280 KB
testcase_25 AC 93 ms
76,496 KB
testcase_26 AC 108 ms
76,580 KB
testcase_27 AC 110 ms
76,504 KB
testcase_28 AC 107 ms
76,376 KB
testcase_29 AC 105 ms
76,508 KB
testcase_30 AC 92 ms
76,556 KB
testcase_31 AC 104 ms
76,504 KB
testcase_32 AC 108 ms
76,900 KB
testcase_33 AC 85 ms
76,288 KB
testcase_34 AC 105 ms
76,368 KB
testcase_35 AC 97 ms
76,480 KB
testcase_36 AC 90 ms
76,540 KB
testcase_37 AC 92 ms
76,320 KB
testcase_38 AC 111 ms
76,892 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

sys.setrecursionlimit(200005)
int1 = lambda x: int(x)-1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]
def SI(): return sys.stdin.readline().rstrip()
# dij = [(0, 1), (-1, 0), (0, -1), (1, 0)]
dij = [(0, 1), (-1, 0), (0, -1), (1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)]
inf = 10**9
# md = 998244353
md = 10**9+7

mx = 10003

n, k = LI()
aa = LI()
aa = [a-k for a in aa]
dp = [0]*(mx*2+5)
dp[0] = 1
for a in aa:
    if a >= 0: s, t, d = mx, -mx, -1
    else: s, t, d = -mx, mx, 1
    for j in range(s, t, d):
        if j+a > mx or j+a < -mx: continue
        dp[j+a] += dp[j]
        dp[j+a] %= md

ans = -1
for j in range(mx):
    ans += dp[j]
    ans %= md

print(ans)
0