結果
| 問題 | No.1336 Union on Blackboard |
| コンテスト | |
| ユーザー |
nephrologist
|
| 提出日時 | 2021-01-15 21:41:12 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 532 bytes |
| 記録 | |
| コンパイル時間 | 260 ms |
| コンパイル使用メモリ | 85,504 KB |
| 実行使用メモリ | 173,376 KB |
| 最終ジャッジ日時 | 2026-05-21 00:46:27 |
| 合計ジャッジ時間 | 20,609 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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