1

Codeforces 671 Div 1 C (ultimate wierdness of array)

Let vi be b1, b2, b3...bk. Note that our l - r must be cover at least k - 1 of this indexes. l must less or equal to b2.

I was able to understand the first part of the solution, but can someone please explain the above statement.

editorial link

Community
  • 1
  • 1

2 Answers2

2

Because if (l-r) covers less than k-1 indexes, then there must be x, y such that bx and by is out of range [l, r], and because i | a[bx], i | a[by], then gcd(a[bx], a[by]) >= i, which is not right, because you are updating next from i to i-1.

Because (l-r) covers at least k-1 elements of b1, ..., bk, so l must be less than or equal to b2.

delta
  • 3,778
  • 15
  • 22
  • i think i understand what u r saying, but i am still not fully convinced with their editorial, what they are doing and why. – shubi_SnowFly May 20 '16 at 01:41
0

define F(l,r) value indicate A[1:n] Subsequence.

A[1....(l-1),(r+1)....] to calculate the max gcd(A[i],A[j])


Sum = ∑ ∑F(i,j) (i!=j)

jiang
  • 31
  • 4