optimizing `build_array`
Check whether we can replace a naive implementation of computing [g^0; g^1; ..; g^{n-1}]
with a more optimized one (if squaring is more efficient than multiplication):
res = [g^0; g^1; ..; g^{n-1}]
, i.e., res[i] = g^i
if n
is divisible by 2, res
can be computed as follows
res[0] = one
res[1] = g
for (int i = 1; i < n / 2; i++) {
res[2*i] = res[i] * res[i];
res[2*i+1] = res[2*i] * g;
}