A Leapfrog in the Array

CodeForces - 950D