摘要: (原题见POJ2010) 这道题我之前采用了优先队列+预处理的方法求解(https://www.cnblogs.com/jacobfun/p/12244509.html),现在用二分的办法进行求解。 一开始我很纳闷,采用二分求解本题,如果二分的mid值不符合条件,按照二分右边界应该为mid - 1( 阅读全文
posted @ 2020-02-24 16:32 funforever 阅读(134) 评论(0) 推荐(0) 编辑
摘要: Given a N × N matrix A, whose element in the i-th row and j-th column Aij is an number that equals i2 + 100000 × i + j2 - 100000 × j + i × j, you are 阅读全文
posted @ 2020-02-22 22:06 funforever 阅读(155) 评论(0) 推荐(0) 编辑
摘要: Santa has to send presents to the kids. He has a large stack of nn presents, numbered from 11 to nn; the topmost present has number a1a1, the next pre 阅读全文
posted @ 2020-02-22 21:40 funforever 阅读(243) 评论(0) 推荐(0) 编辑
摘要: You're given an array a1,…,ana1,…,an of nn non-negative integers. Let's call it sharpened if and only if there exists an integer 1≤k≤n1≤k≤n such that  阅读全文
posted @ 2020-02-19 21:15 funforever 阅读(284) 评论(0) 推荐(0) 编辑
摘要: Vasya came to the store to buy goods for his friends for the New Year. It turned out that he was very lucky — today the offer "kk of goods for the pri 阅读全文
posted @ 2020-02-19 21:05 funforever 阅读(103) 评论(0) 推荐(0) 编辑
摘要: Inhabitants of the Wonderland have decided to hold a regional programming contest. The Judging Committee has volunteered and has promised to organize 阅读全文
posted @ 2020-02-18 09:23 funforever 阅读(199) 评论(0) 推荐(0) 编辑
摘要: Given a positive integer X, an X-factor chain of length m is a sequence of integers, 1 = X0, X1, X2, …, Xm = X satisfying Xi < Xi+1 and Xi | Xi+1 wher 阅读全文
posted @ 2020-02-10 16:53 funforever 阅读(130) 评论(0) 推荐(0) 编辑
摘要: Mike is frantically scrambling to finish his thesis at the last minute. He needs to assemble all his research notes into vaguely coherent form in the 阅读全文
posted @ 2020-02-10 16:21 funforever 阅读(134) 评论(0) 推荐(0) 编辑
摘要: 您是一位在偏远岛屿的邮局工作的程序员。您居住的区域包括几个岛屿。每个岛屿都有一个或多个港口城镇。除了它们之外,可能还有其他城镇。您必须乘船从一个岛到另一个岛。您可以使用陆地路线环岛,但有时使用海上路线会更快。 随着近年来邮局的私有化,全国各地的邮递员数量已经减少,以降低成本。偏远岛屿上的邮局也不例外 阅读全文
posted @ 2020-02-06 21:10 funforever 阅读(171) 评论(0) 推荐(0) 编辑
摘要: d[i]:i到达起始节点的目前最小值。 q:deque,双端队列。 sum:队列中元素和。 SLF:Small Label First 策略,设要加入的节点是j,若d[j]<d[q.front()],则将j插入队首,否则插入队尾 LLL:Large Label Last 策略,设队首元素为i,队列中 阅读全文
posted @ 2020-02-05 20:09 funforever 阅读(261) 评论(0) 推荐(0) 编辑