QOJ.ac

QOJ

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

#22768. 新年派对

Statistiques

$N$ 头牛($3 \le N \le 200$)开新年派对。每头会做若干种食物,单位称“一道菜”。共 $D$ 种($5 \le D \le 100$),编号 $1..D$。

牛群协调者 想最大化带来的菜数,但限制每种数量。每牛可带 $K$ 道($1 \le K \le 5$),必须各不相同(不能带3个牛肉派,可带派、面包与橙汁苜蓿)。最多能带多少?

输入格式

  • 第 $1$ 行:三个整数 $N$、$K$、$D$。
  • 第 $2$ 行:$D$ 个非负整数,各种菜在派对上的数量上限。
  • 第 $3..N+2$ 行:首整数 $Z$($1 \le Z \le D$)为该牛会做种数;余下 $Z$ 整数为食物编号,第一个种类在前、第二个其次,依此类推。

输出格式

一行一个整数,最多能带的菜数。

样例

输入格式 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.