摘要:
(原题见POJ2010) 这道题我之前采用了优先队列+预处理的方法求解(https://www.cnblogs.com/jacobfun/p/12244509.html),现在用二分的办法进行求解。 一开始我很纳闷,采用二分求解本题,如果二分的mid值不符合条件,按照二分右边界应该为mid - 1( 阅读全文
摘要:
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 阅读全文
摘要:
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 阅读全文
摘要:
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 阅读全文
摘要:
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 阅读全文
摘要:
Inhabitants of the Wonderland have decided to hold a regional programming contest. The Judging Committee has volunteered and has promised to organize 阅读全文
摘要:
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 阅读全文
摘要:
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 阅读全文
摘要:
您是一位在偏远岛屿的邮局工作的程序员。您居住的区域包括几个岛屿。每个岛屿都有一个或多个港口城镇。除了它们之外,可能还有其他城镇。您必须乘船从一个岛到另一个岛。您可以使用陆地路线环岛,但有时使用海上路线会更快。 随着近年来邮局的私有化,全国各地的邮递员数量已经减少,以降低成本。偏远岛屿上的邮局也不例外 阅读全文
摘要:
d[i]:i到达起始节点的目前最小值。 q:deque,双端队列。 sum:队列中元素和。 SLF:Small Label First 策略,设要加入的节点是j,若d[j]<d[q.front()],则将j插入队首,否则插入队尾 LLL:Large Label Last 策略,设队首元素为i,队列中 阅读全文