Please read the new rule regarding the restriction on the use of AI tools. ×

SpyroK's blog

By SpyroK, history, 5 hours ago, In English

Given a sequence of integers $$$( a_1, a_2, \dots, a_n )$$$ where $$$( 1 \leq a_i \leq 10^6 )$$$, count the number of subsequences with indices $$$( i_1, i_2, \dots, i_k )$$$ such that:

$$$ k > 0 $$$,

$$$ 1 < i_2 < \dots < i_k \leq n ,$$$

$$$ a_{i_1} \leq a_{i_2} \leq \dots \leq a_{i_k} ,$$$

$$$ \gcd(a_{i_1}, a_{i_2}, \dots, a_{i_k}) = 1 .$$$

The first line contains an integer $$$n $$$ $$$(1 \leq n \leq 3 \times 10^5)$$$, representing the number of elements in the sequence.

The second line contains $$$ n $$$ integers $$$ a_1, a_2, \dots, a_n $$$ $$$(1 \leq a_i \leq 10^6)$$$.

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

»
5 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

Auto comment: topic has been updated by SpyroK (previous revision, new revision, compare).