Polycarp and snakes

Problem Name:
Polycarp and snakes
Site:CodeForces
Links:
Tags:
Problem setters: