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$: שלושה שלמים $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.