please look at this problem

http://codeforces.com/problemset/problem/353/D
i want to know basic strategy to approach this problem

//