As the train is traveling at a constant speed, therefore the ratio of distance to time will be the same over any distance and respective time interval.
The train travels [tex]300+x[/tex] m in 20 s.
As the stationary ceiling lights in the tunnel is directly above the train for 10 s, it means the train travels x m in 10 s, so in 20 s train travels 2 x m.
Therefore,
[tex]300+x=2x[/tex] [tex]\Rightarrow x =300m[/tex]
Hence, the length of the train is 300 m.