Next Smaller Element

Limits 1s, 512 MB

You will be given a long array ararar. The length of the array is n100n^{100}n100 where nnn will be given. The first nnn elements ar[1],ar[2],...,ar[n]ar[1],ar[2],...,ar[n]ar[1],ar[2],...,ar[n] of the array will be given as input. The rest of the elements will be calculated as ar[i]=ar[((i−1)mod n)+1]+((i−1)/n)ar[i] = ar[((i - 1)\mod n) + 1] + ((i - 1) / n)ar[i]=ar[((i−1)modn)+1]+((i−1)/n) where n<i≤n100n < i \le n^{100}n<i≤n100.


This is a companion discussion topic for the original entry at https://toph.co/p/next-smaller-element