Return to problem list2016-1A Problem B
Final solution
func start() {
}
func test() {
var N int
mustReadLineOfInts(&N)
heightsSeen := make(map[int]int)
for i := 0; i < 2*N-1; i++ {
list := mustReadLineOfIntsIntoArray()
assert(len(list) == N)
for _, height := range list {
heightsSeen[height]++
}
}
oddHeights := make([]int, 0, N)
for height, count := range heightsSeen {
if count%2 == 1 {
oddHeights = append(oddHeights, height)
}
}
sort.Ints(oddHeights)
strs := make([]string, 0, N)
for _, oh := range oddHeights {
strs = append(strs, strconv.Itoa(oh))
}
stdout.WriteString(strings.Join(strs, " "))
stdout.WriteByte('\n')
}
Sample test cases given in question
1
3
1 2 3
2 3 5
3 5 6
2 3 4
1 2 3