aeonary's blog

By aeonary, history, 19 months ago, In English

Statement: a sequence of numbers with 2k elements called "Double" if with k elements from left and k from right, we can create k

pairs that two elements in each pair are equal. Give an array A with n elements, n is even, L numbers at the left and R number at

the right. You can perform these following operations on A any number of times (possibly zero):

  • replace A_i with x (x <= n)

  • move 1 element from L to R

  • move 1 element from R to L

Find the minimum number of operations to make A be a double sequence.

Example:

Input: n, L, R and A

6 3 3

1 2 3 2 2 2

Output: minimum number of operations

2

Please help me!!!

  • Vote: I like it
  • 0
  • Vote: I do not like it