CF701A.Cards

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

There are nn cards ( nn is even) in the deck. Each card has a positive integer written on it. n/2n/2 people will play new card game. At the beginning of the game each player gets two cards, each card is given to exactly one player.

Find the way to distribute cards such that the sum of values written of the cards will be equal for each player. It is guaranteed that it is always possible.

输入格式

The first line of the input contains integer nn ( 2<=n<=1002<=n<=100 ) — the number of cards in the deck. It is guaranteed that nn is even.

The second line contains the sequence of nn positive integers a1,a2,...,ana_{1},a_{2},...,a_{n} ( 1<=ai<=1001<=a_{i}<=100 ), where aia_{i} is equal to the number written on the ii -th card.

输出格式

Print n/2n/2 pairs of integers, the ii -th pair denote the cards that should be given to the ii -th player. Each card should be given to exactly one player. Cards are numbered in the order they appear in the input.

It is guaranteed that solution exists. If there are several correct answers, you are allowed to print any of them.

输入输出样例

  • 输入#1

    6
    1 5 7 4 4 3
    

    输出#1

    1 3
    6 2
    4 5
    
  • 输入#2

    4
    10 10 10 10
    

    输出#2

    1 2
    3 4
    

说明/提示

In the first sample, cards are distributed in such a way that each player has the sum of numbers written on his cards equal to 88 .

In the second sample, all values aia_{i} are equal. Thus, any distribution is acceptable.

首页