Turtle and a MEX Problem (Hard Version)

Problem Name:
Turtle and a MEX Problem (Hard Version)
Site:CodeForces
Links:
Tags: