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:69s-->460ms......In Reply To:69s-->460ms...... Posted by:userfriendly at 2009-03-20 21:06:25 > 重写以后弄40000的测试数据跑了69秒,搞了半天,最后在线段树insert方法里面加入了以下一句 > if(st[t*2+1]==st[t*2+2]) > st[t]=st[t*2+1]; > 就是把可以合并的区间合并起来,把时间效率从最坏提到平均。 > 再跑数据,460ms。。。。。。。。。。。。。 > > 感叹。 一定得合并,不然会超时的。 Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator