i_am_not_special's blog

By i_am_not_special, history, 2 weeks ago, In English

You are given an array a of integers with n elements. You are allowed to rearrange the elements of the array in any order. Your task is to determine if it is possible to reorder the array such that for every i from 0 to n-2 (i.e., for all adjacent elements), the absolute difference between consecutive elements is either 5 or 7. That is, for all i such that 0 <= i < n — 1, you need to check if: abs(v[i] — v[i + 1]) = 5 or abs(v[i] — v[i+ 1]) = 7.

Full text and comments »

By i_am_not_special, history, 3 months ago, In English

So the question is count the number of increasing subsequence such that the gcd of subsequence will be equal to 1.

1 <= size of array <= 1e5 1 <= a[i] <= 1e6

can anyone help me solve this problem.

Full text and comments »

  • Vote: I like it
  • +9
  • Vote: I do not like it