結果

問題 No.1682 Unfair Game
ユーザー Navier_BoltzmannNavier_Boltzmann
提出日時 2021-09-17 22:43:15
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 489 bytes
コンパイル時間 299 ms
コンパイル使用メモリ 10,948 KB
実行使用メモリ 20,196 KB
最終ジャッジ日時 2023-09-12 08:43:52
合計ジャッジ時間 15,965 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 28 ms
8,316 KB
testcase_01 AC 17 ms
8,396 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 982 ms
19,960 KB
testcase_08 WA -
testcase_09 AC 960 ms
15,836 KB
testcase_10 WA -
testcase_11 AC 787 ms
14,744 KB
testcase_12 AC 972 ms
15,872 KB
testcase_13 WA -
testcase_14 AC 18 ms
8,240 KB
testcase_15 AC 17 ms
8,328 KB
testcase_16 AC 17 ms
8,356 KB
testcase_17 AC 27 ms
8,436 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 1,009 ms
20,108 KB
testcase_21 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 10**9 + 7
N = int(input())
p = list(map(int,input().split()))
p = [i - 50 for i in p]
dp = [[0]*10002 for _ in range(N)]

def f(x):
    if x>= 0:
        return x
    else:
        return 10002+x
dp[0][f(p[0])] = 1
dp[0][0] = 1

for i in range(N-1):
    a = p[i+1]
    for j in range(-4950,5001):
        dp[i+1][f(j)] += dp[i][f(j - a)]
        dp[i+1][f(j)] += dp[i][f(j)]
        dp[i+1][f(j)] %= mod
ans = 0
for i in range(1,5001):
    ans += dp[N-1][i]
    ans %= mod
print(ans)
0