In my solution http://www.codechef.com/viewsolution/7479607 , in the nested for loop in main, if I don’t use the variable val and directly write j<=L[i].size()-1, then it is not running. Why is that so?
Because size() returns unsigned int. If size() is 0, subtracting 1 from it will give a huge number (2^32 - 1). If you change it to (j <= (long int) L[i].size()-1), it should work.
thanks so much!