I got pretest passed on problem B just before the contest ends ! I was working on C but I didn't came out a solution so I turned to B. Soon I know this problem can be solved using binary search with heap optimization. I finished coding on 1:48 but it was wrong. Then I found a minor mistake of the indices. So I fixed the program but got WA1. And suddenly I found my program outputs 'yes' instead of 'YES'. Well the second submission was successful! hope my solution will pass system tests (It works in O(nlog^2n)) If only I had worked on prob.B earlier.. I would get about 200 more points