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

sort by v asc and w desc then nlogn segment tree O(nlogn)

Posted by dongshanluo at 2011-09-17 00:56:23 on Problem 3598
group by v after sort get K groups

build a segment tree of size K

then 
1. find the best node from segment tree    as Node
2. update the best node to be the node whose v equals Node.v but w less than Node.w

repeat 1 2 ntimes

nlogk + nlogn sort

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