题目 Source http://codeforces.com/problemset/problem/717/G Description You have recently fallen through a hole and, after several hours of unconsciousness, have realized you are in an underground city. On one of your regular, daily walks through the un…
Bracket Substring 这么垃圾的题怎么以前都不会写啊, 现在一眼怎么就会啊.... 考虑dp[ i ][ j ][ k ][ op ] 表示 已经填了 i 个空格, 末尾串匹配到 所给串的 第 j 个, 已经放了 k 个左括号, 是否存在所给串的方案数. 因为不匹配的不是从头开始的, 所以暴力求下一个或者直接ac自动机都可以. #include<bits/stdc++.h> #define LL long long #define LD long double #define u…
ou should process m queries over a set D of strings. Each query is one of three kinds: Add a string s to the set D. It is guaranteed that the string s was not added before. Delete a string s from the set D. It is guaranteed that the string s is in th…
Tree-String Problem 网上的dfs + kmp 复杂度就是错的, 除非算出根据下一个字符直接转移Next数组直接转移, 而求出Next[ i ][ 26 ]数组和丢进AC自动机里面没有区别.. 然后我的AC自动机还写麻烦了.. 我把全部都求进去求fail然后沿着fail推到目标串, 好蠢啊啊. #include<bits/stdc++.h> #define LL long long #define fi first #define se second #define mk m…