i used mos algo for this problem but got TLE on case 43,38 etc;;; i can't get whats wrong with me,,,i saw a solve my type but i got TLE
problem link : http://codeforces.net/contest/86/problem/D
my code : http://codeforces.net/contest/86/submission/19782537
thanx in advance