随笔分类 -  数组

摘要: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 阅读全文
posted @ 2020-05-26 00:33 DeaL57 阅读(160) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2020-05-25 09:23 DeaL57 阅读(145) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2020-05-19 09:43 DeaL57 阅读(170) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2020-05-18 21:04 DeaL57 阅读(297) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2020-05-16 23:03 DeaL57 阅读(235) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2020-05-15 18:12 DeaL57 阅读(233) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2020-05-11 16:35 DeaL57 阅读(221) 评论(0) 推荐(0)
摘要: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. 阅读全文
posted @ 2020-05-04 00:16 DeaL57 阅读(191) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2020-05-03 23:21 DeaL57 阅读(156) 评论(0) 推荐(0)
摘要:VK news recommendation system daily selects interesting publications of one of nn disjoint categories for each user. Each publication belongs to exact 阅读全文
posted @ 2020-04-26 00:23 DeaL57 阅读(212) 评论(0) 推荐(0)