Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
Re:用二分就可以了。In Reply To:Re:不知道nlogn的dp是怎么搞的..哪位可否讲解下。 Posted by:enter2004 at 2007-09-08 01:19:10 tot = 0; for (i = 1; i <= n; ++i) { int lo = 0; int hi = tot + 1; while (lo + 1 < hi) { int mid = (lo + hi) >> 1; ((ans[mid] < inp[i]) ? lo : hi) = mid; } ans[hi] = inp[i]; if (hi > tot) { tot = hi; } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator