Блог пользователя yamih23436

Автор yamih23436, история, 4 года назад, По-английски

Say , size of given array is $$$N$$$ and $$$abs(a[i])$$$<= 10000000

Example :

$$$ {1,100,100,100,100} $$$

Minimum cost = $$$4$$$

$$${1,100,101,99,102}$$$

I am looking for both $$$O(n*n)$$$ and $$$O(n)$$$ solutions .

Source of the problem : Just occurred to my mind .

My idea : Sort the given array , then apply the algorithm mentioned in this problem : https://mirror.codeforces.com/contest/713/problem/C

  • Проголосовать: нравится
  • +8
  • Проголосовать: не нравится