Three Parts of the Array

CodeForces - 1006C