QOJ.ac

QOJ

実行時間制限: 2 s メモリ制限: 256 MB 満点: 100

#22659. פוליטיקת Jersey

統計

במפקד האחרון של פרות Jersey ו־Holstein קיבלו פרות Wisconsin שלושה תאים ב־Barn of Representatives. Jersey שולטות כעת בוועדת החלוקה מחדש של המדינה. הן רוצות שלושה מחוזות בחירה שווים בגודלם עם ניצחון מובטח בלפחות שניים.

ב־Wisconsin יש $3*K$ ($1 \le K \le 60$) ערים של $1,000$ פרות, שמספריהן $1..3*K$. מספר Jersey בכל עיר ידוע ($0..1,000$). חלקו את המדינה לשלושה מחוזות של $K$ ערים, שבהם Jersey יהיו רוב בלפחות שניים.

כל נתוני הקלט פתירים.

קלט

  • שורה $1$: שלם יחיד $K$.

  • שורות $2..3*K+1$: שלם בכל שורה, מספר Jersey בכל עיר. שורה $i+1$ מכילה את מפקד עיר $i$.

פלט

  • שורות $1..K$: $K$ שורות של מספרי ערי המחוז הראשון, אחד בשורה.

  • שורות $K+1..2K$: $K$ שורות של מספרי ערי המחוז השני, אחד בשורה.

  • שורות $2K+1..3K$: $K$ שורות של מספרי ערי המחוז השלישי, אחד בשורה.

דוגמאות

קלט 1

2
510
500
500
670
400
310

פלט 1

1
2
3
6
5
4

הערה

ייתכנו פתרונות אחרים. 2 3 לא יהיה מחוז שבו Jersey מנצחות: הן בדיוק מחצית מהפרות.

מחבר הבעיה: Coaches, 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.