CodeForces - 1221E Game With String(不平等博弈) Alice and Bob play a game. Initially they have a strings1,s2,…,sns1,s2,…,sn, consisting of only characters.andX. They take alternating turns, and Alice is moving first. During each turn, the ...
2019CCPC秦皇岛 E题 Escape(网络流) Escape Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 16Accepted Submission(s): 12 Problem Description Given a maze of size n×m. ...
2019CCPC秦皇岛D题 Decimal Decimal Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 103Accepted Submission(s): 49 Problem Description Given a positive integer...
2019CCPC秦皇岛I题 Invoker(DP) Invoker Time Limit: 15000/12000 MS (Java/Others)Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 117Accepted Submission(s): 35 Problem Description In dota2, there is a h...
2019CCPC秦皇岛 F Forest Program 队友过的:https://blog.csdn.net/liufengwei1/article/details/101632506 Forest Program Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 124...
2019CCPC秦皇岛 J MUV LUV EXTRA(KMP) MUV LUV EXTRA Time Limit: 2000/1500 MS (Java/Others)Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 134Accepted Submission(s): 49 Problem Description One day, Kagami Su...
2019CCPC秦皇岛 K MUV LUV UNLIMITED(博弈) MUV LUV UNLIMITED Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 143Accepted Submission(s): 16 Problem Description 联合国太平洋方面第11军横滨...
2018 牛客国庆集训派对Day4 - H 树链博弈 链接:https://ac.nowcoder.com/acm/contest/204/H来源:牛客网 题目描述 给定一棵 n 个点的树,其中 1 号结点是根,每个结点要么是黑色要么是白色 现在小 Bo 和小 Biao 要进行博弈,他们两轮流操作,每次选择一个黑色的结点将它变白,之后可以选择任意多个(可以不选)该点的祖先(不包含自己),然后将这些点的颜色翻转,不能进行操...
POJ1704 Georgia and Bob(Nim博弈变形) Georgia and Bob Time Limit:1000MS Memory Limit:10000K Total Submissions:14312 Accepted:4840 Description Georgia and Bob decide to play a self-invented ...
CF240E Road Repairs(最小树形图-记录路径) A country named Berland hasncities. They are numbered with integers from1ton. City with index1is the capital of the country. Some pairs of cities have monodirectional roads built between t...
2019 ICPC上海网络赛 A 题 Lightning Routing I (动态维护树的直径) 题目: 给定一棵树, 带边权。 现在有2种操作: 1.修改第i条边的权值。 2.询问u到其他一个任意点的最大距离是多少。 题解: 树的直径可以通过两次 dfs() 的方法求得。换句话说,到任意点最远的点,一定是直径的某个端点(反证法)。 • 因此原问题转化为动态维护直径,然后再支持询问两个点的距离,后者可以 dfs 序 + lca + 树状数组。 参考代码: ...
HDU3032 Nim or not Nim?(Lasker’s Nim游戏) Nim or not Nim? Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 3759Accepted Submission(s): 1937 Problem Description Nim is a two-pl...
HDU4918 Query on the subtree 点分治+树状数组 bobo has a tree, whose vertices are conveniently labeled by 1,2,…,n. At the very begining, the i-th vertex is assigned with weight wi.There are q operations. Each operations are of the following...
HDU3710 Battle over Cities(最小生成树+树链剖分+倍增+线段树) Battle over Cities Time Limit: 10000/5000 MS (Java/Others)Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 467Accepted Submission(s): 125 Problem Description It is vitally...
2019ICPC 上海网络赛 G题 Substring(哈希) 题意: 给了一个母串S, 每次循环给了一个模板串,问模板串在母 串中“匹配”了多少次?“匹配”的意思就是首字母和尾字母一样, 中间字母顺序可以换。 题解: 字符串hash.我们将询问字符串的首尾特殊hash,然后将询问串的长度存入到vector里面。 然后遍历一遍原串,将所有是询问串长度的子串的哈希值插入到vecor并排序,然后对于该询问,我们只要用lower_bound和u...
计蒜客-蒜场抽奖(AC自动机+状态压缩DP) 题解:题意不再说了,题目很清楚的。 思路:因为N<=10,所以考虑状态压缩 AC自动机中 val[1<<i]: 表示第i个字符串。AC自动机中fail指针是指当前后缀在其他串里面所能匹配的最长前缀的长度,然后我们在这里统计一下以该点结束所能包含的字符串的数量(就是在fail树中该点到根节点所经过的所有为单词结尾的点,在这里我们只要val[x]...
POJ3164 Command Network(最小树形图) After a long lasting war on words, a war on arms finally breaks out between littleken’s and KnuthOcean’s kingdoms. A sudden and violent assault by KnuthOcean’s force has rendered a total failur...
HDU4117 GRE WORDS(AC自动机+线段树维护fail树的dfs序) Recently George is preparing for the Graduate Record Examinations (GRE for short). Obviously the most important thing is reciting the words. Now George is working on a word list containing N wor...
CF547E Milk and Friends(AC自动机的fail指针上建主席树 或 广义后缀自动机的parent线段树合并)... What-The-Fatherland is a strange country! All phone numbers there are strings consisting of lowercase English letters. What is double strange that a phone number can be associated with several be...
CodeChef FAVNUM FavouriteNumbers(AC自动机+数位dp+二分答案) All submissions for this problem are available. Chef likes numbers and number theory, we all know that. There areNdigit strings that he particularly likes. He likes them so much that he define...