随笔分类 - Codeforces
摘要:A. Array Balancing You are given two arrays of length nn: a1,a2,…,ana1,a2,…,an and b1,b2,…,bnb1,b2,…,bn. You can perform the following operation any n
阅读全文
摘要:把字符串看作是26进制的数,从后往前翻译,那么就可以把两个串变成对应的26进制的数字,那么只要把两个数加起来除以二就得到中间的串对应的数了,同理再转化回来就行了。但是这样会有一个问题就是串的长度有2e5,26的2e5次方显然不可求,所以需要对每一位进行手动的加和运算。对于两个串,我们假设a串从后往前
阅读全文
摘要:You are given a tree (a connected undirected graph without cycles) of 𝑛n vertices. Each of the 𝑛−1n−1 edges of the tree is colored in either black o
阅读全文
摘要:You went to the store, selling 𝑛n types of chocolates. There are 𝑎𝑖ai chocolates of type 𝑖i in stock. You have unlimited amount of cash (so you ar
阅读全文
摘要:You are given a string 𝑠=𝑠1𝑠2…𝑠𝑛s=s1s2…sn of length 𝑛n, which only contains digits 11, 22, ..., 99. A substring 𝑠[𝑙…𝑟]s[l…r] of 𝑠s is a stri
阅读全文
摘要:E. Superhero Battle A superhero fights with a monster. The battle consists of rounds, each of which lasts exactly 𝑛n minutes. After a round ends, the
阅读全文
摘要:Rick and his co-workers have made a new radioactive formula and a lot of bad guys are after them. So Rick wants to give his legacy to Morty before bad
阅读全文
摘要:C. Ayoub and Lost Array Ayoub had an array 𝑎 of integers of size 𝑛 and this array had two interesting properties: All the integers in the array were
阅读全文
摘要:Ralph is going to collect mushrooms in the Mushroom Forest. There are m directed paths connecting n trees in the Mushroom Forest. On each path grow so
阅读全文
摘要:Let's call a string adorable if its letters can be realigned in such a way that they form two consequent groups of equal symbols (note that different
阅读全文
摘要:After waking up at hh:mm, Andrew realised that he had forgotten to feed his only cat for yet another time (guess why there's only one cat). The cat's
阅读全文
摘要:In Arcady's garden there grows a peculiar apple-tree that fruits one time per year. Its peculiarity can be explained in following way: there are n inf
阅读全文
摘要:Anya and Kirill are doing a physics laboratory work. In one of the tasks they have to measure some value n times, and then compute the average value t
阅读全文
摘要:The last stage of Football World Cup is played using the play-off system. There are n teams left in this stage, they are enumerated from 1 to n. Sever
阅读全文
摘要:Two friends are on the coordinate axis Ox in points with integer coordinates. One of them is in the point x1 = a, another one is in the point x2 = b.
阅读全文
摘要:Alice and Bob begin their day with a quick game. They first choose a starting number X0 ≥ 3 and try to reach one million by the process described belo
阅读全文
摘要:http://codeforces.com/contest/948/problem/C C. Producing Snow Alice likes snow a lot! Unfortunately, this year's winter is already over, and she can't
阅读全文
摘要:http://codeforces.com/contest/948/problem/A A. Protect Sheep Bob is a farmer. He has a large pasture with many sheep. Recently, he has lost some of th
阅读全文