結果
| 問題 | No.1336 Union on Blackboard |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-01-15 21:40:02 |
| 言語 | PyPy3 (8.0.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 40 ms / 2,000 ms |
| + 552µs | |
| コード長 | 609 bytes |
| 記録 | |
| コンパイル時間 | 72 ms |
| コンパイル使用メモリ | 82,280 KB |
| 実行使用メモリ | 76,200 KB |
| 最終ジャッジ日時 | 2026-09-30 09:38:31 |
| 合計ジャッジ時間 | 3,422 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge4_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 31 |
ソースコード
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(2*10**5+10)
write = lambda x: sys.stdout.write(x+"\n")
_print = lambda *x: print(*x, file=sys.stderr)
t = int(input())
M = 10**9+7
def sub(a):
n = len(a)
dp = [0]*(n+1)
dp[0] = 1
for i in range(n):
ndp = [0]*(n+1)
ndp[0] = 1
for j in range(1,n+1):
ndp[j] = dp[j-1]*a[i] + dp[j]
ndp[j] %= M
dp = ndp
# print(dp)
ans = sum(dp[1:])%M
return ans
for _ in range(t):
n = int(input())
a = list(map(int, input().split()))
print(sub(a))