正文
增加 5 行删除 5 行
11 行未改动12131415161718192073 行未改动94959697989910010110210310410510610710810911011111211311411511611711811912018 行未改动13914014114214314414514614734 行未改动11 行未改动下面开始说正话状态记录题意可以转化为在方格图上填1...�×�73 行未改动return stt;}void decode(uint stt) {for(int i = n; i >= 0; i--) plug[i] = stt & 3, stt >>= 2;for(int i = n; i; i--) pos[i] = stt & 255, stt >>= 8;}void solve() {bitset<maxl> used;used.reset();cur = 0; pre = 1; hah(0, 1, used);for(int j = 1; j <= m; j++) {// 新的一行要把plug整体右移for(int t = 1; t <= tot[cur]; t++) {decode(ptr[cur][t].stt);for(int i = n - 1; i >= 0; i--) plug[i + 1] = plug[i];plug[0] = 0;ptr[cur][t].stt = encode();}for(int i = 1; i <= n; i++) {swap(cur, pre); tot[cur] = 0;memset(head[cur], 0, sizeof(head[cur]));for(int t = 1; t <= tot[pre]; t++) {uint stt = ptr[pre][t].stt;int val = ptr[pre][t].val;used = ptr[pre][t].used;decode(stt);int r = plug[i - 1], d = plug[i];18 行未改动if(x == 1 && i > 1 && i < n && j > 1 && j < m) continue;if(i == n && j == m) ans = (ans + val) % mod;used[x] = 1; int od = pos[i]; pos[i] = x;// cout << x << endl;for(int npr = 0; npr <= 2; npr++)for(int npd = 0; npd <= 2; npd++) {// 枚举新的插头,判断是否合法,这部分我写的比较冗杂,或许可以精简一下int pnum = (r > 0) + (d > 0) + (npr > 0) + (npd > 0);if(x != 1 && x != n * m && pnum != 2) continue;34 行未改动11 行未改动12131415161718192073 行未改动94959697989910010110210310410510610710810911011111211311411511611711811912018 行未改动13914014114214314414514614734 行未改动11 行未改动下面开始说正话状态记录题意可以转化为在方格图上填1...�×�73 行未改动return stt;}void decode(uint stt) {for(int i = n; i >= 0; i--) plug[i] = stt & 3, stt >>= 2;for(int i = n; i; i--) pos[i] = stt & 255, stt >>= 8;}void solve() {bitset<maxl> used;used.reset();cur = 0; pre = 1; hah(0, 1, used);for(int j = 1; j <= m; j++) {// 新的一行要把plug整体右移for(int t = 1; t <= tot[cur]; t++) {decode(ptr[cur][t].stt);for(int i = n - 1; i >= 0; i--) plug[i + 1] = plug[i];plug[0] = 0;ptr[cur][t].stt = encode();}for(int i = 1; i <= n; i++) {swap(cur, pre); tot[cur] = 0;memset(head[cur], 0, sizeof(head[cur]));for(int t = 1; t <= tot[pre]; t++) {uint stt = ptr[pre][t].stt;int val = ptr[pre][t].val;used = ptr[pre][t].used;decode(stt);int r = plug[i - 1], d = plug[i];18 行未改动if(x == 1 && i > 1 && i < n && j > 1 && j < m) continue;if(i == n && j == m) ans = (ans + val) % mod;used[x] = 1; int od = pos[i]; pos[i] = x;// cout << x << endl;for(int npr = 0; npr <= 2; npr++)for(int npd = 0; npd <= 2; npd++) {// 枚举新的插头,判断是否合法,这部分我写的比较冗杂,或许可以精简一下int pnum = (r > 0) + (d > 0) + (npr > 0) + (npd > 0);if(x != 1 && x != n * m && pnum != 2) continue;34 行未改动