随笔分类 - ACM-数据结构
摘要:Atlantis Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Problem Description There are several ancient Greek texts th
阅读全文
摘要:1143-Lowest Common Ancestor The lowest common ancestor (LCA) of two nodes U and V in a tree is the deepest node that has both U and V as descendants.
阅读全文
摘要:L2-006. 树的遍历给定一棵二叉树的后序遍历和中序遍历,请你输出其层序遍历的序列。这里假设键值都是互不相等的正整数。输入格式:输入第一行给出一个正整数N( R) return; res[idx] = pos[root]; int i = L; while (in[i] != pos[root]) i++; build(L, i-1, idx*2+1, root-1-R+...
阅读全文
摘要:How Many Answers Are Wrong Time Limit: 2000/1000 MS (Java/Others) Problem Description TT and FF are ... friends. Uh... very very good friends -_______
阅读全文
摘要:Auxiliary Set Time Limit: 9000/4500 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) Problem Description Given a rooted tree with n vertices
阅读全文
摘要:1003Counting Divisors 题意: 给定l, r,k, 计算公式$(\sum_{i=1}^{r}d(i^k))mod\,998244353$ 思路: 函数$d(x)$表示x的因子数。利用算数基本定理可以算出函数,而且根据公式可以知道$i^k$可以通过$i$计算。利用筛选素数的方法快速
阅读全文
摘要:偷了个懒。。。好几次的多校的题没有补。。。 1003.Kanade's sum Time Limit: 2000 MS 题意: 给出含有n个元素的数组A,A的元素是1~n的任意一个排列,求出任意区间第K的数的和。 思路: 比赛的时候是毫无头绪,后来看了题解,明白了解法。从最小的元素开始考虑,每次在他
阅读全文
摘要:1001:Is Derek lying? 题意: 给你两个人的成绩和答案,判断这两个成绩是否合理。 思路: 先对字符串进行比较,得到相同的选项数same,和不同的选项数diff。如果两个人中最小的成绩小于same,那说明他们相同的选项中有错的。成绩最高的那个对的选项数除了same之外是否超过diff
阅读全文
摘要:Balanced Lineup Time Limit: 5000MS Memory Limit: 65536K Total Submissions: 50004 Accepted: 23434 Case Time Limit: 2000MS Description For the daily mil
阅读全文
摘要:Hat’s Words Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 13908 Accepted Submission(s): 4987 P
阅读全文
摘要:I Hate It Time Limit: 9000/3000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 67459 Accepted Submission(s): 26244 Pr
阅读全文
摘要:题目链接 首先,题意比较清楚,给你n-1个数,表示从2到n,其中ai表示编号为i头牛所处位置的前面有几个的序号比他小。通过这些数据,让你输出这些牛的排列顺序。 思路: 对于最后的一头牛,他肯定是(an+1),通过这个规律,可以到这推出所有牛的顺序,你可以标记,然后暴力跑一边,但是效率不高。 这里,可
阅读全文
摘要:Team Queue Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 1999 Accepted Submission(s): 688 Prob
阅读全文
摘要:Fxx and game Time Limit: 3000/1500 MS (Java/Others) Memory Limit: 131072/65536 K (Java/Others) Total Submission(s): 347 Accepted Submission(s): 78 Pro
阅读全文
摘要:Sliding Window Sliding Window Time Limit: 12000MS Memory Limit: 65536K Total Submissions: 55797 Accepted: 16048 Case Time Limit: 5000MS Description An
阅读全文
摘要:1080 - Binary Simulation PDF (English) Statistics Forum Time Limit: 2 second(s) Memory Limit: 64 MB Given a binary number, we are about to do some ope
阅读全文
摘要:Wireless Network Time Limit: 10000MS Memory Limit: 65536K Total Submissions: 24091 Accepted: 10022 Description· An earthquake takes place in Southeast
阅读全文
摘要:Stars Description Astronomers often examine star maps where stars are represented by points on a plane and each star has Cartesian coordinates. Let th
阅读全文
摘要:Minimum Inversion Number Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 18277 Accepted Submissi
阅读全文
摘要:Ultra-QuickSort Time Limit: 7000MS Memory Limit: 65536K Total Submissions: 55716 Accepted: 20578 Description In this problem, you have to analyze a pa
阅读全文