2017 CCPC秦皇岛 A题 A Ballon Robot】的更多相关文章

The 2017 China Collegiate Programming Contest Qinhuangdao Site is coming! There will be  teams participating in the contest, and the contest will be held on a huge round table with  seats numbered from 1 to  in clockwise order around it. The -th team…
PUBG is a multiplayer online battle royale video game. In the game, up to one hundred players parachute onto an island and scavenge for weapons and equipment to kill others while avoiding getting killed themselves. BaoBao is a big fan of the game, bu…
BaoBao is trapped in a one-dimensional maze consisting of  grids arranged in a row! The grids are numbered from 1 to  from left to right, and the -th grid is marked with a character , where  is either 'L' or 'R'. Starting from the -th grid, BaoBao wi…
BaoBao has just found a string  of length  consisting of 'C' and 'P' in his pocket. As a big fan of the China Collegiate Programming Contest, BaoBao thinks a substring  of  is "good", if and only if  'C', and  'P', where  denotes the -th charact…
Given an array of  integers , we say a set  is a prime set of the given array, if  and  is prime. BaoBao has just found an array of  integers  in his pocket. He would like to select at most  prime set of that array to maximize the size of the union o…
DreamGrid has a nonnegative integer . He would like to divide  into nonnegative integers  and minimizes their bitwise or (i.e.  and  should be as small as possible). Input There are multiple test cases. The first line of input contains an integer , i…
2017 ccpc哈尔滨 A题 Palindrome 题意: 给一个串\(T\),计算存在多少子串S满足\(S[i]=S[2n−i]=S[2n+i−2](1≤i≤n)\) 思路: 很明显这里的回文串长度为奇数,所以用\(manacher\)处理时不需要添加间隔字符 所以这里的\(Len[i]\)表示的就是以\(i\)为中心的回文串向左右最远能延伸的长度 那么\(S[i]=S[2n−i]=S[2n+i−2](1≤i≤n)\)就等价于 找到一对$(i,j), 满足i - Len[i] + 1 <=…
题目链接  2017 CCPC Hangzhou  Problem E 题意  给定一棵树,每个点有一个权值,现在我们可以选一些连通的点,并且把这点选出来的点的权值相加,得到一个和. 求$[1, m]$里面哪些值可以被表示成选出来的点的权值和.用$01$序列的方式输出. 重现赛赛场上的我英勇无畏,大胆做$3000$次FFT合并两个bitset表示的答案. 然后TLE到结束(活该) 其实这个题确实要用bitset,关键是能不能把合并两个bitset转化成合并一个数和一个bitset. 考虑点分治.…
题目链接  2017 CCPC Hangzhou Problem H 思路:对树进行分块.把第一棵树分成$\sqrt{n}$块,第二棵树也分成$\sqrt{n}$块.    分块的时候满足每个块是一个连通块,那么每个块就有一个共同的祖先. 把询问按照第一个点被第一棵树的哪个祖先管辖和第二个点被第二棵树的哪个祖先管辖,分成$n$类. 每一类询问一起处理,处理完后用可撤销并查集恢复到之前的状态. 每一类询问之间依次转移,每次转移,移动次数不会超过$\sqrt{n}$次. 最后总时间复杂度$O(n^{…
Crusaders Quest is an interesting mobile game. A mysterious witch has brought great darkness to the game world, and the only hope for your kingdom is to save the Goddesses so that they can unleash their power to fight against the witch. In order to s…