Length Preserving One way function
$p(n)$ is just a polynomial that indicates the length of the output of the function $g$, as a function of the length of the input.  Imagine that it's something like $27n$ or $2n^2$, and then read through the proof and you'll see how it works.

I didn't see any requirement to compute an inverse of $p(\cdot)$ in that proof.  I'm not sure where you got that from.  But anyway, if you wanted to invert it, any such polynomial is monotonic and can be easily inverted, e.g., by using binary search or using Newton's method.