Why am I getting TLE even though the complexity looks O(n*log(n)) to me?
Problem: http://codeforces.com/contest/1185/problem/D
Code: http://codeforces.com/contest/1185/submission/55804919