b. finding team member
time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output
there is a programing contest named snakeup, 2n people want to compete for it. in order to attend this contest, people need to form
teams of exactly two people. you are given the strength of each possible combination of two people. all the values of the strengths aredistinct.
every contestant hopes that he can find a teammate so that their team’s strength is as high as possible. that is, a contestant will form a team with highest strength possible by choosing a teammate from ones who are willing to be a teammate with him/her. more
formally, two people a and b may
form a team if each of them is the best possible teammate (among the contestants that remain unpaired) for the other one.
can you determine who will be each person’s teammate?
there are 2n lines in the input.
the first line contains an integer n (1 ≤ n ≤ 400)
— the number of teams to be formed.
the i-th line (i > 1)
contains i - 1 numbers ai1, ai2,
... , ai(i - 1).
here aij (1 ≤ aij ≤ 106,
all aij are
distinct) denotes the strength of a team consisting of person i and person j (people
are numbered starting from 1.)
output a line containing 2n numbers. the i-th
number should represent the number of teammate of i-th person.
sample test(s)
note
in the first sample, contestant 1 and 2 will
be teammates and so do contestant 3 and 4,
so the teammate of contestant 1, 2, 3, 4 will
be2, 1, 4, 3 respectively.
题目大意:
就是给你 2*n 个人,给一个下三角矩阵,要求选2n组人,每组两人,arr[i][j]表示i和j在一起的分数,每次选的结果都是当前可能的最大值,
(一个人只能在一组里)
解题思路:
暴力做就行只是要考虑一下数组的大小,我一般为了方便起见都把数组开的比较大,
1000*1000的就行,其实805*805应该也行。
上代码: