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

用线段树返回离查询点最近的点的坐标即可水过!

Posted by 117474335 at 2010-11-01 19:38:56 on Problem 2892
再贴一个主要函数:
void search1 (int nu, int x)
{
    int mi = (tr[nu].a + tr[nu].b) >> 1 ;
    if (tr[nu].a == tr[nu].b){
        if (tr[nu].v) e1 = tr[nu].a; 
        return ;}
    if (x > mi && tr[nu << 1 | 1].v) search1 (nu << 1 | 1, x) ;
    if (!e1) search1 (nu << 1 , x) ;
}

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