so i tried to solve this two problem and they both got WA test 2
here's the problems 2012-2013 Waterloo Local Contest, 13 October, 2012 :
so i want to know the main idea of the both gym problems if possible and what is the trick in the second test case ?