UPDATED Sammy Gerbil rightly pointed out that my answer was wrong - and I apologize. So here is the "real" answer...
Let's start with the following diagram:
It is a diagram of the possible trajectories of the cannonball, fired at different angles. In green is the "critical" angle - the one that would just reach a height of 250 m. But as you can see - that is NOT the angle that will hit the jet at the furthest possible point! It is possible to aim a little higher, and get a little further (thanks Sammy Gerbil for pointing this out).
The question showed an equation for the trajectory that not everyone may be familiar with. I wasn't... So I decided to convince myself by deriving it from the parametric equation that I know. For a projectile fired with velocity $v$ at an angle $\theta$ to the horizontal, the horizontal and vertical components of velocity are:
$$v_x = v\cos\theta\\
vy=v\sin\theta-g\cdot t$$
We can integrate these w.r.t. time to get the position:
$$x = v\cos\theta\cdot t\\
y = v \sin \theta \cdot t - \frac12 g t^2$$
Rearranging the expression for $x$ gives us $t$:
$$t = \frac{x}{v\cos\theta}$$
Substituting this into the expression for $y$ we get
$$y = \frac{v\sin\theta\cdot x}{v\cos\theta} - \frac12 g \frac{x^2}{v^2 \cos^2\theta}\\
= x \tan\theta -\frac{g x^2}{2 v^2}\left(1+\tan^2\theta\right)$$
This is familiar to you - it was new to me. But it was the next bit where you were having trouble. You calculated the range of times at which a bullet might reach the height $h$, and assumed that the longest time taken would correspond to the furthest possible shot (which is actually not true: the time taken would be longest if the bullet is fired straight up). You also assumed that the bullet would intersect the jet that passed overhead when it was fired. Since the jet is flying faster than the bullet, this can never be true. The fact that your solution even got close to the right numerical value, then, is something of a miracle. [ but see below... I think after your latest edit I understand this "miracle" ]
So let's continue with the reasoning. We need to find the furthest possible distance $x$ that can be reached at height $h$. The only variable is $\theta$. This means that if we take the derivative of $x$ with respect to $\theta$, the stationary point (zero slope) corresponds to the furthest distance (you have to check that it's not the closest distance, of course). This is what the answer in the book did. But (and this is the clever bit), recognizing that $\tan\theta$ is a monotonic function over the range of values of interest $<-\pi/2,\pi/2]>$, one can equally decide to take a derivative with respect to $\tan\theta$. Usually this would be done formally by substitution of variables; the book's solution takes a short cut.
If we put $q = \tan\theta$, we can rewrite the equation of the trajectory as
$$y = x q - \frac{gx^2}{2 v^2}(1+q^2)\tag1$$
and the value of $q$ where the stationary point is (furthest reach) happens when
$$\frac{dy}{dq}=0$$
Note - using this approach, we are allowing $y$ to vary with $\theta$ - we find the highest possible value of $y$ at a given $x$. This is mathematically easier to do because the expression is linear in $y$. However, this gets us to an expression for the dashed red line in my diagram just as if I had taken the derivative of $x$ with respect to $\theta$ - but it would have been harder work.
This means
$$0 = x - \frac{q g x^2}{v^2}\\
x = \frac{q g x^2}{v^2}\\
q = \frac{v^2}{g x}$$
Substituting this expression for $q$ back into the trajectory (1), we get
$$y = \frac{v^2}{g} - \frac{g x^2}{2 v^2}\left(1 + \left(\frac{v^2}{g x}\right)^2\right)\\
= \frac{v^2}{2g} - \frac{g x^2}{2 v^2}$$
This describes a parabola that is the envelope of all possible points that can be reached (because at each value of $y$ it gives us the largest and smallest $x$ that can be hit). I added that curve as a red dashed line in the figure. And now the solution is simple.
We just have to find the range of values $x$ that are inside the red dashed line - in other words, we solve
$$h = \frac{v^2}{2g} - \frac{g x^2}{2 v^2}\\
x^2 = \frac{2 v^2}{g}\left(\frac{v^2}{2g}-h\right)$$
This gives us two values for $x$ - a positive and a negative one. If you set $g=10 ~\rm{m/s}$, the interval is $[-500\sqrt{2}, 500\sqrt{2}]$ and since the jet is flying at a velocity of 500 m/s, it is vulnerable for a total of $\sqrt{8}$ seconds - the time it takes to fly through the zone where the cannon could reach it.
Note that the cannon will at all times have to be fired considerably before the jet enters the "protected airspace" - even if fired straight up, it will take over 2.5 seconds to rach the height of the jet.
For your reference, here is the Python code used to generate the plot:
import numpy as np
import matplotlib.pyplot as plt
from math import pi,sqrt,acos,asin
vgun = 100.0
h = 250.0
g = 9.81
t = np.linspace(0,20,200)
# the curve that just touches the path of the jet:
vy_critical = sqrt(2*g*h)
th_critical = acos(vy_critical / vgun)
ax=plt.figure()
vx = vgun*np.sin(th_critical)
vy = vgun*np.cos(th_critical)
x = t*vx
y = vy*t-0.5*g*t*t
plt.plot(x,y,'g')
x = -x;
plt.plot(x,y,'g')
# add a number of trajectories at different angles:
for theta in np.linspace(-90,90,19)*pi/180:
vx = vgun*np.sin(theta)
vy = vgun*np.cos(theta)
x = t*vx
y = vy*t-0.5*g*t*t
plt.plot(x,y,'b')
# limiting angle - largest range
th_crit = asin(sqrt((-2*g*h+vgun*vgun)/(-2*g*h+2*vgun*vgun)))
vxc = vgun*np.sin(th_crit)
vyc = vgun*np.cos(th_crit)
xc = t*vxc
yc = t*vyc -0.5*g*t*t
plt.plot(xc,yc,'m')
plt.plot(-xc,yc,'m')
# add the path of the jet:
plt.plot([-800,800],[h,h],'r')
# limit the range of the axes:
ax=plt.gca()
ax.set_ylim((0,2*h))
ax.set_xlim((-800,800))
plt.xlabel('horizontal position (m)')
plt.ylabel('vertical position (m)')
plt.title('possible trajectories')
# add the envelope of trajectories
x = np.linspace(-800,800,1000)
y = vgun*vgun/(2*g) - g*x*x/(2*vgun*vgun)
plt.plot(x,y,'r',ls='--') # red dashed line
plt.show()
UPDATE
So - what, if anything, is wrong with the latest version of your solution (which is getting the right answer, after all)? I had to think about it for quite a while, but I think I figured out what is going on. My confusion was not helped by the fact that you used $x$ to mean two different things - both the initial position of the jet when the cannon is fired, and the position where it is intercepted by the cannon.
But this is why your solution works. You are solving for all possible trajectories that intersect, and for which $\tan\theta$ is valid. This leads to an inequality in your term $p^2$, and that gives you a minimum and maximum value of $p$. Finally, since $p = 500 t + x_0$, and you have both $p_{max}$ and $p_{min}$, you can find the difference in time without needing to know what $x_0$ was.
Circuitous, but correct.
The usual approach is to find the maximum value of $x$, by taking the derivative. That's what both the book and my solution did. But you did in fact find another valid way to get the solution. So well done.
Best Answer
Due to momentum being conserved, when you accelerate yourself forwards relative to the plane, the tangential force you're applying to the floor will accelerate the rest of the plane backwards. Since the plane has a lot more mass than you, its velocity will not change by very much.
Thus, an inertial observer who was initially at rest with respect to the plane (and you) will see both you and the plane gain kinetic energy (due to your muscle work). The vast majority of the additional kinetic energy goes into you, though.
However, an observer on the ground will see the rest-of-the-plane slow down slightly, which means that it loses quite a bit of kinetic energy due to its large mass and velocity. This loss of kinetic energy from the plane cancels out the additional kinetic energy the ground observer thinks you gained, so the ground observer's energy ledger still balances.
(Mathematically, to the ground observer $v$ is, to a first approximation, both the ratio between your your gained momentum and your gained kinetic energy, and the ratio between the plane's lost momentum and its lost kinetic energy. So conservation of momentum leads to conservation of total energy, to first order. The term that comes from your muscle work is a second-order effect).
Both observers agree on the amount of energy your muscles contribute (at least as long as relativistic effects can be ignored).