题目 题意: 略。 思路: 用字符串哈希优化dfs。 时间复杂度: O(能过) 代码:
#include
using namespace std;
typedef unsigned long long ull;
const int N = 1e5+10;
const int P = 131;
int a[N];
vector va[102],v,res;
bool vis[N];
bool flag = 0;
int n,m,k,T;
ull p[N],h[N],f[N];
ull get(int l,int r)
{
return h[r] - h[l-1]*p[r-l+1];
}
bool dfs(int cur,int now)
{
// cout
关注
打赏