QOJ.ac

QOJ

حد الوقت: 1 s حد الذاكرة: 512 MB مجموع النقاط: 50

#13410. 披萨

الإحصائيات

在工作了漫长而痛苦的一天后,Mirko 决定点一份比萨作为晚餐来让自己开心起来。在他书桌上的一大堆文件中,他找到了附近一家比萨店的传单。

这家比萨店提供 $m$ 种不同的比萨。比萨的配料用正整数标记。第 $i$ 种比萨有 $k_i$ 种配料,其标记分别为 $b_{i,1}, b_{i,2}, \dots, b_{i,k_i}$。

Mirko 对食物非常挑剔。他不喜欢的配料有 $n$ 种,其标记分别为 $a_1, a_2, \dots, a_n$。因此,他想点一份不包含任何这些配料的比萨。请确定 Mirko 可以点的比萨数量。

输入格式

第一行包含一个整数 $n$($1 \le n \le 100$),表示 Mirko 不喜欢的配料数量,随后是 $n$ 个互不相同的整数 $a_i$($1 \le a_i \le 100$),表示他不喜欢的配料的标记。

第二行包含一个整数 $m$($1 \le m \le 100$),表示比萨的数量。

接下来的 $m$ 行描述这些比萨。第 $i$ 行包含一个整数 $k_i$($1 \le k_i \le 100$),表示配料的数量,随后是 $k_i$ 个互不相同的整数 $b_{i,j}$($1 \le b_{i,j} \le 100$),表示第 $i$ 种比萨上的配料标记。

所有的比萨(即配料的集合)都是互不相同的。

输出格式

输出 Mirko 可以点的比萨数量。

子任务

在价值 20 分的测试数据中,满足 $n = 1$ 且 $k_1 = k_2 = \dots = k_m = 1$。

样例

输入样例 1

1 2
3
1 1
1 2
1 3

输出样例 1

2

输入样例 2

2 1 2
4
2 1 4
3 1 2 3
2 3 4
3 3 5 7

输出样例 2

2

输入样例 3

1 4
3
1 1
1 2
1 3

输出样例 3

3

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.