pratikshaw's blog

By pratikshaw, history, 10 months ago, In English

You are given an array of size n, consisting of non negative integers. Find the number of subarrays of arr which are special. A subarray is special if it satisfies the following condition: The product of the maximum and the minimum element of the subarray is divisible by the length of the subarray. Find the number of special subarrays of the array.

1<=n<=1e5

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

»
10 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Not able to find solution less than n^2. Please someone help

»
10 months ago, # |
  Vote: I like it +6 Vote: I do not like it

I think this has already been answered here.
https://codeforces.com/blog/entry/118209

  • »
    »
    10 months ago, # ^ |
      Vote: I like it +6 Vote: I do not like it

    Oh bro, this guy omits the range of $$$a_i$$$.