Help in Light OJ 1301
In Light OJ1301 what is the simplest idea to solve it ? My code here . It got TLE . I know the approach is wrong but can't figure it out. Please anyone help.