Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

STL当然慢了

Posted by Ruby931031 at 2012-12-01 01:15:03 on Problem 1201 and last updated at 2012-12-01 01:15:30
In Reply To:Re:差分约束+spfa险过!! Posted by:_Doraemon at 2010-10-15 13:00:57
它的queue要管理内存啊,queue底层默认用deque实现,当所开空间不够时要申请扩容
(就好比你原来开了一个1w的queue发现不够用了,就得新申请存储空间,才能放下新加进来的元素),凡是涉及动态内存管理的当然慢了……

自己手写队列的话就是随便浪费空间(我开了一个200w的queue),一次分配好,只要front和rear两个指针不断移动就行了,自然会快很多。

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator