303625: CF701A. Cards

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Cards

题意翻译

## 题目描述 现在有$n$张卡牌($n$为偶数),每张卡牌上都写着一个正整数。有$n/2$个人要玩这个卡牌游戏,在游戏开始时每个人会得到两张卡牌,每张卡牌只能给一个玩家。 现在让你发卡牌,使每一个人手上的卡片上所写的数字的总和相等。数据保证有发牌的方案符合题目要求。 ## 输入输出格式 ### 输入格式: 第一行包括一个整数$n$$(2<=n<=100)$,表示一共有的卡牌数。 第二行包括$n$个正整数$a_1,a_2,...,a_n$$(1<=ai<=100)$,$a_i$表示第$i$张卡牌上的数字。 ### 输出格式: 输出$n/2$对整数,第$i$对数表示应给第$i$个玩家的卡牌。每张卡牌只能给一个人,卡牌的编号按照输入的顺序编号。 数据保证有发牌的方案符合题目要求。如果有多种方案,可任意输出一个答案。

题目描述

There are $ n $ cards ( $ n $ is even) in the deck. Each card has a positive integer written on it. $ n/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 $ n $ ( $ 2<=n<=100 $ ) — the number of cards in the deck. It is guaranteed that $ n $ is even. The second line contains the sequence of $ n $ positive integers $ a_{1},a_{2},...,a_{n} $ ( $ 1<=a_{i}<=100 $ ), where $ a_{i} $ is equal to the number written on the $ i $ -th card.

输出格式


Print $ n/2 $ pairs of integers, the $ i $ -th pair denote the cards that should be given to the $ i $ -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 $ 8 $ . In the second sample, all values $ a_{i} $ are equal. Thus, any distribution is acceptable.

Input

题意翻译

## 题目描述 现在有$n$张卡牌($n$为偶数),每张卡牌上都写着一个正整数。有$n/2$个人要玩这个卡牌游戏,在游戏开始时每个人会得到两张卡牌,每张卡牌只能给一个玩家。 现在让你发卡牌,使每一个人手上的卡片上所写的数字的总和相等。数据保证有发牌的方案符合题目要求。 ## 输入输出格式 ### 输入格式: 第一行包括一个整数$n$$(2<=n<=100)$,表示一共有的卡牌数。 第二行包括$n$个正整数$a_1,a_2,...,a_n$$(1<=ai<=100)$,$a_i$表示第$i$张卡牌上的数字。 ### 输出格式: 输出$n/2$对整数,第$i$对数表示应给第$i$个玩家的卡牌。每张卡牌只能给一个人,卡牌的编号按照输入的顺序编号。 数据保证有发牌的方案符合题目要求。如果有多种方案,可任意输出一个答案。

加入题单

算法标签: