Greedy/Binary Search/Dilworth's theorem

http://apps.topcoder.com/forums/?module=Thread&threadID=672864&start=0&mc=7

http://codeforces.com/blog/entry/6086