An unexpected application of the Cauchy-Schwarz inequality for integrals I discovered this yesterday and I just want to know whether my solution is correct and whether there's a shortcut to it.

Let $g(x)$ be a twice-differentiable continuous function that crosses the points $(0, t)$ and $(1, 1)$ and has stationary points there with $t\in(0,1)$. Then if  $$\text{sgn}\left(\int_0^1g(x)g''(x)\,dx\right)-\text{sgn}\left(\int_0^1\frac1{g(x)}\,dx\right)=\pm2$$ for some constant $K\in\mathbb{R}$, $$g(x)=Kg'(x)^2.$$ Furthermore, $g''(x)=\dfrac1{2K}$ when $x\in\mathbb{R}-\{0, 1\}$.

Solution
We use the Cauchy-Schwarz inequality for integrals with $a=0$ and $b=1$:
$$\left[\int_0^1\frac{g'(x)}{\sqrt{g(x)}}\,dx\right]^2\le\left(\int_0^1g'(x)^2\,dx\right)\left(\int_0^1\frac1{g(x)}\,dx\right)\tag{1}$$
Firstly, consider the LHS. Let $u=g(x)\implies du=g'(x)\,dx$; thus LHS is $$\left[\int_0^1\frac{g'(x)}{\sqrt{g(x)}}\,dx\right]^2=\left[\int_{g(0)}^{g(1)}\frac1{\sqrt{u}}\,du\right]^2=\left(\left[2\sqrt{u}\right]_t^1\right)^2=4(1-\sqrt t)^2=T>0 \tag{2}$$ as $g(0)=t$ and $g(1)=1$. Now use integration by parts for the first integral on the RHS: $$\int_0^1g'(x)^2\,dx=\left[g(x)g'(x)\right]_0^1-\int_0^1g(x)g''(x)\,dx=-\int_0^1g(x)g''(x)\,dx\tag{3}$$ as $g'(0)=g'(1)=0$. Plugging $(2)$ and $(3)$ into $(1)$, we get $$-T\ge\left(\int_0^1g(x)g''(x)\,dx\right)\left(\int_0^1\frac1{g(x)}\,dx\right)\tag{4}$$ with equality holding if, and only if, $$\dfrac{g'(x)}{\sqrt{g(x)}}=k\implies g(x)=\frac1{k^2}g'(x)^2=Kg'(x)^2$$ where $k,K\in\mathbb{R}$ are constants. Differentiating this, we have $g'(x)=2Kg'(x)g''(x)$.
We can divide by $g'(x)\neq0$ when $x\neq0, 1$ so for $x\in\mathbb{R}-\{0,1\}$, $$g''(x)=\frac1{2K}.$$ 
Now back to $(4)$. $$\int_0^1g(x)g''(x)\,dx>0\implies\int_0^1\frac1{g(x)}\,dx<0$$ and $$\int_0^1g(x)g''(x)\,dx<0\implies\int_0^1\frac1{g(x)}\,dx>0$$ This means that the sign of $\int_0^1g(x)g''(x)\,dx$ is always opposite that of $\int_0^1\frac1{g(x)}\,dx$. The result follows.
 A: $\def\d{\mathrm{d}} \def\sgn{\mathrm{sgn}}$For a fixed $t \in (0, 1)$, take$$
g(x) = -2(1 - t) x^3 + 3(1 - t) x^2 + t,
$$
so $g(0) = t$ and $g(1) = 1$. Because$$
g'(x) = 6(1 - t) x(1 - x),
$$
then $x = 0$ and $x = 1$ are stationary points of $g(x)$ and $g$ is increasing on $[0, 1]$. Thus for $x \in [0, 1]$, $g(x) \geqslant g(0) = t > 0$, so$$
\int_0^1 \frac{1}{g(x)} \,\d x > 0.
$$
Also,\begin{align*}
&\mathrel{\phantom{=}} \int_0^1 g(x) g''(x) \,\d x\\
&= 6(1 - t) \int_0^1 (-2(1 - t) x^3 + 3(1 - t) x^2 + t)(-2x + 1) \,\d x\\
&= 24(1 - t)^2 \int_0^1 x^4 \,\d x - 48(1 - t)^2 \int_0^1 x^3 \,\d x + 18(1 - t)^2 \int_0^1 x^2 \,\d x\\
&\mathrel{\phantom{=}} - 12t(1 - t) \int_0^1 x \,\d x + 6t(1 - t)\\
&= \frac{24}{5} (1 - t)^2 - 12(1 - t)^2 + 6(1 - t)^2 - 6t(1 - t) + 6t(1 - t)\\
&= -\frac{6}{5} (1 - t)^2 < 0.
\end{align*}
Therefore,$$
\sgn\left( \int_0^1 g(x) g''(x) \,\d x \right) - \sgn\left( \int_0^1 \frac{1}{g(x)} \,\d x \right) = -2.
$$
However, because $\deg g = 3$ and $\deg (g')^2 = 2 \deg g' = 4$, there does not exist a constant $K$ such that$$
g(x) = K(g'(x))^2. \quad \forall x \in (0, 1)
$$
