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

此题有O(q+mlogm)的算法(设序列中不同值的个数为m)

Posted by mike_nzk at 2009-04-04 20:26:44 on Problem 3368 and last updated at 2009-04-04 20:27:38
每次询问不需要O(logn)复杂度。
只要从小到大记录这个序列每个值的起始位置、结束位置和频数(即离散化),对频数进行rmq即可,每次询问只用O(1)的复杂度,300多ms就可以过了。

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