QOJ.ac

QOJ

時間限制: 2 s 記憶體限制: 256 MB 總分: 100

#22768. 新年パーティー

统计

$N$ 頭($3 \le N \le 200$)が新年パーティーをします。各牛はいくつかの食べ物を作れ、単位は一皿です。全 $D$ 種($5 \le D \le 100$)、番号 $1..D$。

牛の調整役 は皿数を最大にしたいが種類ごとの上限があります。各牛 $K$ 皿($1 \le K \le 5$)で全て異なる種類です(牛のパイ3つは不可、パイ、パン、オレンジソースのアルファルファなら可)。最大いくつ?

入力

  • $1$ 行目:3整数 $N$、$K$、$D$。
  • $2$ 行目:$D$ 非負整数、各種類の総数上限。
  • $3..N+2$ 行目:最初の整数 $Z$($1 \le Z \le D$)は作れる種類数、残り $Z$ 整数は食品番号で、1種類目、2種類目の順です。

出力

一行整数、持ち込める最大皿数。

入出力例

入力 1

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

出力 1

9

注記

入力説明

データ — 説明

  • 4 3 5 — 4頭、各最大3皿、全5種類。
  • 2 2 2 2 3 — 種類1–4は各最大2皿、5は3皿。
  • 4 1 2 3 4 — この牛は4種類:1、2、3、4。
  • 4 2 3 4 5 — この牛は4種類:2、3、4、5。
  • 3 1 2 4 — この牛は3種類:1、2、4。
  • 3 1 2 3 — この牛は3種類:1、2、3。

出力説明

[牛1は3、4;牛2は3、4、5;牛3は1、2;牛4は1、2を持参。]

問題作成者:Hal Burch, 2001

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.