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

因为x的坐标有可能为0,如果x=0的时候你要将这个点加入的话你会发现出现了死循环

Posted by Sempr at 2007-01-01 14:47:26 on Problem 2352
In Reply To:Re:用树状数组为什么也超时? Posted by:richardxx at 2007-01-01 14:26:54
> 好神奇哦,为什么全部x+1就不超时呢??
> 请Sempr解释一下好么?

while (idx<MAXN){
    arr[idx]+=diff;
    idx += lowBit(idx); // 如果idx=0,那么这个地方idx将永远是0
}

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