QOJ.ac

QOJ

Limite de temps : 2 s Limite de mémoire : 256 MB Points totaux : 100

#22650. 探検隊

Statistiques

牛たちは Farmer John の領地の端の森を調べる探検隊を作りたいと思っています。探検には牧草地で草を食べて立っている以上の技能が必要です。

番号 1..$C$ の $C$ 頭($1 \le C \le 20$)からなる隊には、森で迷わず進む、大きく凶暴な生き物を追い払う、冗談で士気を高めるなどの能力が必要です。番号 1..$A$ の $A$ 個($1 \le A \le 20$)の特殊能力のそれぞれを、隊の少なくとも一頭が持っていなければなりません。一つしか持たない牛、多数持つ牛、まったく役に立たないただ乗りの牛もいます。

全牛と各能力が与えられたとき、隊全体としてすべての能力を持つ異なる探検隊の数を求めてください。

入力

  • 1 行目:整数 $C$ と $A$。
  • 2..$A$+1 行目:各行は空白区切りの整数で一つの能力を表します。2 行目は能力 1、3 行目は能力 2、……です。最初の整数 $K$($1 \le K \le C$)はその能力を持つ牛の数で、続く $K$ 個の整数はその牛を表します。

出力

  • 1 行目:作れる異なる探検隊の数を表す整数。

入出力例

入力 1

4 2
2 3 1
1 2

出力 1

6

注記

入力の詳細

牛は 4 頭、能力は二つです。牛 1 と 3 は能力 1、牛 2 だけが能力 2 を持ちます。牛 4 はあまり才能がありません。

出力の詳細

可能な探検隊は $\{1, 2\}$、$\{2, 3\}$、$\{1, 2, 3\}$、$\{1, 2, 4\}$、$\{2, 3, 4\}$、$\{1, 2, 3, 4\}$ です。

問題作成:Percy Liang、2004

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.