随笔分类 - 数组
摘要:Suppose you are performing the following algorithm. There is an array v1,v2,…,vnv1,v2,…,vn filled with zeroes at start. The following operation is app
阅读全文
摘要:Petya and Vasya are competing with each other in a new interesting game as they always do. At the beginning of the game Petya has to come up with an a
阅读全文
摘要:You have an array aa of length nn. For every positive integer xx you are going to perform the following operation during the xx-th second: Select some
阅读全文
摘要:For the multiset of positive integers s={s1,s2,…,sk}s={s1,s2,…,sk}, define the Greatest Common Divisor (GCD) and Least Common Multiple (LCM) of ss as
阅读全文
摘要:As a huge fan of the popular collectible card game Numinous Wilds: the Elven Reign Chronicles (NWERC), you have a large collection of cards which you
阅读全文
摘要:Pay attention to the non-standard memory limit in this problem. In order to cut off efficient solutions from inefficient ones in this problem, the tim
阅读全文
摘要:A permutation of length nn is an array p=[p1,p2,…,pn]p=[p1,p2,…,pn], which contains every integer from 11 to nn (inclusive) and, moreover, each number
阅读全文
摘要:This is the hard version of this problem. The only difference is the constraint on kk — the number of gifts in the offer. In this version: 2≤k≤n2≤k≤n.
阅读全文
摘要:Recall that the permutation is an array consisting of nn distinct integers from 11 to nn in arbitrary order. For example, [2,3,1,5,4][2,3,1,5,4] is a
阅读全文
摘要:VK news recommendation system daily selects interesting publications of one of nn disjoint categories for each user. Each publication belongs to exact
阅读全文

浙公网安备 33010602011771号