What is the solution to BALSUB-ACM18AMR

Had to miss out on the editorial for this problem at onsite. Can someone tell the solution to this problem

//