随笔分类 - 题库—Codeforces比赛
摘要:The length of the longest common prefix of two strings and is defined as the maximum integer k0≤k≤min*(n,*m)) such
阅读全文
摘要:Vladimir would like to prepare a present for his wife: they have an anniversary! He decided to buy her exactly nn flowers. Vladimir went to a flower s
阅读全文
摘要:Pasha loves to send strictly positive integers to his friends. Pasha cares about security, therefore when he wants to send an integer nn , he encrypts
阅读全文
摘要:Acacius is studying strings theory. Today he came with the following problem. You are given a string ss of length nn consisting of lowercase English l
阅读全文
摘要:You are given a graph consisting of nn vertices and mm edges. It is not guaranteed that the given graph is connected. Some edges are already directed
阅读全文
摘要:You are given a string s[1…n]s[1…n] consisting of lowercase Latin letters. It is guaranteed that n=2kn=2k for some integer k≥0k≥0 . The string s[1…n]s
阅读全文
摘要:You are given an array aa consisting of nn integers. You have to find the length of the smallest (shortest) prefix of elements you need to erase from
阅读全文
摘要:A permutation of length nn is a sequence of integers from 11 to nn of length nn containing each number exactly once. For example, [1][1] , [4,3,5,1,2]
阅读全文
摘要:You are given three positive (i.e. strictly greater than zero) integers xx , yy and zz . Your task is to find positive integers aa , bb and cc such th
阅读全文
摘要:There are nn programmers that you want to split into several non-empty teams. The skill of the ii -th programmer is aiai . You want to assemble the ma
阅读全文
摘要:You are given a permutation p1,p2,…,pnp1,p2,…,pn . Recall that sequence of nn integers is called a permutation if it contains all integers from 11 to
阅读全文
摘要:Recently, you found a bot to play "Rock paper scissors" with. Unfortunately, the bot uses quite a simple algorithm to play: he has a string s=s1s2…sns
阅读全文
摘要:Patrick likes to play baseball, but sometimes he will spend so many hours hitting home runs that his mind starts to get foggy! Patrick is sure that hi
阅读全文
摘要:In Omkar's last class of math, he learned about the least common multiple, or LCMLCM . LCM(a,b)LCM(a,b) is the smallest positive integer xx which is d
阅读全文
摘要:You have been blessed as a child of Omkar. To express your gratitude, please solve this problem for Omkar! An array aa of length nn is called complete
阅读全文
摘要:今天做完POJ2182,突然想起来这道很久以前没补的cf题了,这两个题思路惊人的相似2333. 借用某谷的翻译:你需要维护一个可重集。初始时里面有n个正整数{A1,A2,⋯An},它们的值域为[1,n]。现在有q个操作,共有两类:• 1,若k为负数,则删除排名为∣k∣的数字。若不存在排名为∣k∣的数
阅读全文
摘要:The last contest held on Johnny's favorite competitive programming platform has been received rather positively. However, Johnny's rating has dropped
阅读全文
摘要:Among Johnny's numerous hobbies, there are two seemingly harmless ones: applying bitwise operations and sneaking into his dad's office. As it is usual
阅读全文
摘要:Johnny has recently found an ancient, broken computer. The machine has only one register, which allows one to put in there one variable. Then in one o
阅读全文
摘要:Ashish has a tree consisting of nn nodes numbered 11 to nn rooted at node 11 . The ii -th node in the tree has a cost aiai , and binary digit bibi is
阅读全文