Double Sequence problem

Revision en2, by aeonary, 2022-09-27 17:29:30

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!!!

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English aeonary 2022-09-27 17:29:30 21 Tiny change: 'ons\n\n2\n' -> 'ons\n\n2\n\nPlease help me!!!\n'
en1 English aeonary 2022-09-27 17:28:36 662 Initial revision (published)