摘要: 1 namespace MappingBinaryHeap{ 2 /* 3 DS: 4 Datastructure to show the value 5 Heap: 6 1.Ds:value 7 2.idx:index 8 pos: 9 The position for each index10 len:11 The volum n of heap12 hh:13 heap14 Push:15 insert an element16... 阅读全文
posted @ 2013-04-12 15:39 yefeng1627 阅读(304) 评论(0) 推荐(0) 编辑
摘要: Problem A 客户数量 可以得出将长度为 len的蛋糕切成 len段 1的,不管如何切,总花费都为 len*(len-1)/2 对于每个顾客,来到的时间st,以及需要的蛋糕长度k,则有一个终止时间ed = st+k*(k-1)/2 对每个顾客求出其服务终止时间,然后得到n个区间,将区间以终点排序,然后线性扫过去,用i的起点时间与前一个服务顾客 的终点时间比较即可。 时间复杂度 O( NlogN )View Code #include<cstdio>#include<cstring>#include<algorithm>#include<casse 阅读全文
posted @ 2013-04-12 12:31 yefeng1627 阅读(325) 评论(0) 推荐(0) 编辑

Launch CodeCogs Equation Editor