結果
| 問題 |
No.1336 Union on Blackboard
|
| コンテスト | |
| ユーザー |
nephrologist
|
| 提出日時 | 2021-01-15 21:41:12 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 532 bytes |
| コンパイル時間 | 175 ms |
| コンパイル使用メモリ | 82,132 KB |
| 実行使用メモリ | 266,812 KB |
| 最終ジャッジ日時 | 2024-11-26 13:44:01 |
| 合計ジャッジ時間 | 74,891 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | WA * 11 TLE * 20 |
ソースコード
import sys
input = sys.stdin.buffer.readline
mod = 10 ** 9 + 7
t = int(input())
from collections import defaultdict
for _ in range(t):
n = int(input())
A = list(map(int, input().split()))
pre = defaultdict(int)
pre[0] = 1
for a in A:
nx = defaultdict(int)
for num in pre.keys():
cnt = pre[num]
nx[num] = cnt
nx[(num + a) % mod] = cnt
pre = nx
ans = 0
for key, val in pre.items():
ans += key * val
ans %= mod
print(ans)
nephrologist