結果

問題 No.1682 Unfair Game
ユーザー Navier_BoltzmannNavier_Boltzmann
提出日時 2021-09-17 22:44:42
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
WA  
実行時間 -
コード長 491 bytes
コンパイル時間 140 ms
コンパイル使用メモリ 10,920 KB
実行使用メモリ 20,216 KB
最終ジャッジ日時 2023-09-12 08:46:41
合計ジャッジ時間 15,801 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 27 ms
8,296 KB
testcase_01 AC 18 ms
8,276 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 986 ms
20,020 KB
testcase_08 WA -
testcase_09 AC 939 ms
15,872 KB
testcase_10 WA -
testcase_11 AC 765 ms
14,548 KB
testcase_12 AC 971 ms
15,948 KB
testcase_13 WA -
testcase_14 AC 17 ms
7,912 KB
testcase_15 AC 17 ms
8,300 KB
testcase_16 AC 17 ms
8,200 KB
testcase_17 AC 27 ms
8,376 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 990 ms
20,216 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