bzoj3864.cc
#include #include #include using namespace std; const int mod = 1e9 + 7; const int maxs = 17; const int maxst = (1 « 15) + 3; const char deoxynucleotide[5] = “AGCT”; #define mInc(a,b) { a += b; if (a >= mod) a -= mod; } int n, m, f[2][maxst], ans[maxs]; int trv[maxst][4]; char s[maxs]; int getTrans(int i, int j) { static int fc[maxs], fd[maxs]; fc[0] = fd[0] = 0; for (int k = 0; k < n; ++ k) fc[k + 1] = fc[k] + ((i » k) & 1); for (int k = 1; k <= n; ++ k) { if (s[k] == deoxynucleotide[j]) fd[k] = fc[k - 1] + 1; else if (fc[k] > fd[k - 1]) fd[k] = fc[k]; else fd[k] = fd[k - 1]; } int sn(0); for (int k = 0; k < n; ++ k) sn |= (fd[k + 1] - fd[k]) « k; return sn; }...