結果

問題 No.1238 選抜クラス
ユーザー mkawa2mkawa2
提出日時 2021-09-02 00:08:49
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 971 bytes
コンパイル時間 607 ms
コンパイル使用メモリ 87,264 KB
実行使用メモリ 77,332 KB
最終ジャッジ日時 2023-08-19 07:02:51
合計ジャッジ時間 6,365 ms
ジャッジサーバーID
(参考情報)
judge10 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 86 ms
76,512 KB
testcase_01 AC 86 ms
76,368 KB
testcase_02 AC 88 ms
76,732 KB
testcase_03 AC 79 ms
76,516 KB
testcase_04 AC 78 ms
76,644 KB
testcase_05 AC 80 ms
76,600 KB
testcase_06 AC 80 ms
76,472 KB
testcase_07 AC 90 ms
76,620 KB
testcase_08 AC 84 ms
76,468 KB
testcase_09 AC 92 ms
76,612 KB
testcase_10 AC 86 ms
76,644 KB
testcase_11 AC 89 ms
76,616 KB
testcase_12 AC 87 ms
76,572 KB
testcase_13 AC 92 ms
76,580 KB
testcase_14 AC 85 ms
76,376 KB
testcase_15 AC 86 ms
76,472 KB
testcase_16 AC 88 ms
76,652 KB
testcase_17 AC 108 ms
76,568 KB
testcase_18 AC 106 ms
76,572 KB
testcase_19 AC 112 ms
77,180 KB
testcase_20 AC 103 ms
76,752 KB
testcase_21 AC 108 ms
76,580 KB
testcase_22 AC 92 ms
76,464 KB
testcase_23 AC 99 ms
76,536 KB
testcase_24 WA -
testcase_25 AC 94 ms
76,464 KB
testcase_26 AC 105 ms
76,580 KB
testcase_27 AC 109 ms
76,704 KB
testcase_28 AC 106 ms
76,420 KB
testcase_29 AC 106 ms
76,640 KB
testcase_30 AC 92 ms
76,528 KB
testcase_31 AC 101 ms
76,640 KB
testcase_32 AC 108 ms
77,332 KB
testcase_33 AC 84 ms
76,472 KB
testcase_34 AC 105 ms
76,776 KB
testcase_35 AC 98 ms
76,736 KB
testcase_36 AC 92 ms
76,540 KB
testcase_37 AC 92 ms
76,372 KB
testcase_38 AC 113 ms
77,244 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 = 10000

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