上一页 1 ··· 7 8 9 10 11
摘要: 今天对着算法进阶指南,学了一下离散化。大概对桶排这样的算法优化比较好吧。 离散化:就是把无穷大的集合中若干个元素映射为有限集合以便于统计的方法。例如在很多时候,问题范围定义为整数集合Z,但涉及的元素只有m个。(桶排优化) 此时,我们就可以把这些整数与(1-m)建立起映射关系,再去掉重复的元素。 先排 阅读全文
posted @ 2019-05-13 21:29 hh13579 阅读(171) 评论(0) 推荐(0)
摘要: For a given sequence A={a0,a1,...an−1}A={a0,a1,...an−1}, the number of pairs (i,j)(i,j) where ai>ajai>aj and i<ji<j, is called the number of inversion 阅读全文
posted @ 2019-05-08 17:47 hh13579 阅读(387) 评论(0) 推荐(0)
摘要: Description 一种新型的激光炸弹,可以摧毁一个边长为R的正方形内的所有的目标。现在地图上有n(N<=10000)个目标,用整数Xi,Yi(其值在[0,5000])表示目标在地图上的位置,每个目标都有一个价值。激光炸弹的投放是通过卫星定位的,但其有一个缺点,就是其爆破范围,即那个边长为R的正 阅读全文
posted @ 2019-05-04 16:48 hh13579 阅读(182) 评论(0) 推荐(0)
摘要: 但洛谷那道题还是超时,后面还是用以前写的归并排序过的(其实我之前用sort过的) 阅读全文
posted @ 2019-05-03 21:52 hh13579 阅读(173) 评论(0) 推荐(0)
摘要: Quick Sort Let's arrange a deck of cards. Your task is to sort totally n cards. A card consists of a part of a suit (S, H, C or D) and an number. Writ 阅读全文
posted @ 2019-05-03 21:29 hh13579 阅读(270) 评论(0) 推荐(0)
摘要: Merge Sort Write a program of a Merge Sort algorithm implemented by the following pseudocode. You should also report the number of comparisons in the 阅读全文
posted @ 2019-05-03 19:01 hh13579 阅读(305) 评论(0) 推荐(0)
摘要: Description A histogram is a polygon composed of a sequence of rectangles aligned at a common base line. The rectangles have equal widths but may have 阅读全文
posted @ 2019-05-03 17:05 hh13579 阅读(182) 评论(0) 推荐(0)
上一页 1 ··· 7 8 9 10 11