QOJ.ac

QOJ

Time Limit: 2 s Memory Limit: 256 MB Total points: 100

#22659. Jersey Politics

Statistics

In the newest census of Jersey Cows and Holstein Cows, Wisconsin cows have earned three stalls in the Barn of Representatives. The Jersey Cows currently control the state's redistricting committee. They want to partition the state into three equally sized voting districts such that the Jersey Cows are guaranteed to win elections in at least two of the districts.

Wisconsin has $3*K$ ($1 \le K \le 60$) cities of 1,000 cows, numbered $1..3*K$, each with a known number (range: 0..1,000) of Jersey Cows. Find a way to partition the state into three districts, each with $K$ cities, such that the Jersey Cows have the majority percentage in at least two of districts.

All supplied input datasets are solvable.

Input

  • Line 1: A single integer, $K$

  • Lines $2..3*K+1$: One integer per line, the number of cows in each city that are Jersey Cows. Line $i+1$ contains city $i$'s cow census.

Output

  • Lines $1..K$: $K$ lines that are the city numbers in district one, one per line

  • Lines $K+1..2K$: $K$ lines that are the city numbers in district two, one per line

  • Lines $2K+1..3K$: $K$ lines that are the city numbers in district three, one per line

Examples

Input 1

2
510
500
500
670
400
310

Output 1

1
2
3
6
5
4

Output Details

Other solutions might be possible. Note that "2 3" would NOT be a district won by the Jerseys, as they would be exactly half of the cows.

Problem credits: 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.