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:莫队算法+线段树!复杂度(n + q)sqrt(n)*log(n),可以是无序序列,可惜TLE。。In Reply To:莫队算法+线段树!复杂度(n + q)sqrt(n)*log(n),可以是无序序列,可惜TLE。。 Posted by:JuniorBird at 2013-09-18 11:42:09 虽然不知道莫队算法是神马,但是 我觉得你的代码 有问题: q[i].block根本就没有用上(排序是对q[i].block排的但是本质还是对q[i].l排序, q[i].block=q[i].l/BLOCK, BLOCK是个constant),也就是说你的整个算法跟BLOCK== sqrt(n)无关,估计也就是O(n*q*log())了。。。。 Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator