Codeforces round 425 Problem B

Can any help me With the question
Problem Link

This is just an implementation problem. The editorial is given, right?