随笔分类 - 数据结构-树状数组
摘要:武当派一共有 nn 人,门派内 nn 人按照武功高低进行排名,武功最高的人排名第 11,次高的人排名第 22,... 武功最低的人排名第 nn。现在我们用武功的排名来给每个人标号,除了祖师爷,每个人都有一个师父,每个人可能有多个徒弟。 我们知道,武当派人才辈出,连祖师爷的武功都只能排行到 pp。也就
阅读全文
摘要:A - Garden Problem Statement There is a farm whose length and width are A yard and B yard, respectively. A farmer, John, made a vertical road and a ho
阅读全文
摘要:Guessing Camels Jaap, Jan, and Thijs are on a trip to the desert after having attended the ACM ICPC World Finals 2015 in Morocco. The trip included a
阅读全文
摘要:Ultra-QuickSort Ultra-QuickSort In this problem, you have to analyze a particular sorting algorithm. The algorithm processes a sequence of n distinct
阅读全文
摘要:BST Consider an infinite full binary search tree (see the figure below), the numbers in the nodes are 1, 2, 3, .... In a subtree whose root node is X,
阅读全文