Badminton
InterviewTime limit1sMemory limit1024 MB
Pair Bitai's six players into three teams to maximize the wins among nine pair-versus-pair matches against Baitai's three pair strengths.
- Level
Easy3 of 10
- Topics
- Brute force, Implementation
- Solved
- No attempts yet
Statement
The badminton team Bitai from Bitlandija plays the final match against the team Baitai from Baitlandija. Since Baitai plays at home, they announced their lineup in advance.
Each team consists of three pairs of players.
- Each player has a strength index .
- If players and form a pair, the pair's strength index is .
- When two pairs play each other, the pair with the higher strength index wins.
Using the announced information, Bitai wants to form a team that beats Baitai. Each pair of Bitai plays each pair of Baitai once, for a total of 9 matches. Can Bitai win?
Form 3 pairs from the Bitai players so that they win as many matches as possible. The data is such that ties are impossible.
Input
The first line contains the pair strength indices , , of the Baitai pairs. The next six lines contain the strength indices of the individual Bitai players, one per line.
Output
Print an integer , the number of matches Bitai can win. On the next three lines, print any valid team arrangement that achieves this best result. Each line lists the strength indices of the two players in one pair.
Constraints