QOJ.ac

QOJ

حد الوقت: 2 s حد الذاكرة: 256 MB مجموع النقاط: 100

#22768. Festa di Capodanno

الإحصائيات

$N$ mucche ($3 \le N \le 200$) festeggiano Capodanno. Ciascuna cucina vari alimenti, in unità dette piatti. Totale $D$ tipi ($5 \le D \le 100$), numeri $1..D$.

coordinatore delle mucche massimizza piatti con limite per tipo. Ogni mucca porta $K$ piatti ($1 \le K \le 5$), distinti (non3 torte bovine, ma torta, pane e erba medica in salsa d’arancia). Quanto al massimo?

Input

  • Riga $1$: tre interi $N$, $K$, $D$.
  • Riga $2$: $D$ interi non negativi, limiti totali per tipo.
  • Righe $3..N+2$: primo intero $Z$ ($1 \le Z \le D$), numero di tipi preparabili; poi $Z$ identificatori, primo tipo prima, secondo dopo ecc.

Output

Una riga, intero: massimo piatti.

Esempi

Input 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

Output 1

9

Nota

Dettagli dell’ingresso

dati — spiegazione

  • 4 3 5 — 4 mucche, ciascuna fino3 piatti,5 tipi.
  • 2 2 2 2 3 — Tipi1–4 fino2 ciascuno, tipo5 fino3.
  • 4 1 2 3 4 — Questa mucca cucina4 tipi:1, 2, 3, 4.
  • 4 2 3 4 5 — Cucina4 tipi:2, 3, 4, 5.
  • 3 1 2 4 — Cucina3 tipi:1, 2, 4.
  • 3 1 2 3 — Cucina3 tipi:1, 2, 3.

Dettagli dell’uscita

[Mucca1 porta3, 4;2 porta3, 4, 5;3 porta1, 2;4 porta1, 2.]

Autore del problema: 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.