版本比较
题解:P1713 麦当劳叔叔的难题
正文
增加 8 行删除 8 行
64 行未改动6566676869697071727374757576777879798081828383848586873 行未改动919293949595969798993 行未改动10310410510610710710810911011011111211311421 行未改动13613713813914014014114214314428 行未改动64 行未改动 int state = h[last][q[last][k]], w = v[last][q[last][k]]; int x = get(state, j - 1), y = get(state, j); if (!g[i][j]) { insert(cur, state, w); } } else if (!x && !y) { insert(cur, state, w); if (g[i + 1][j] && g[i][j + 1]) { insert(cur, state + build(j - 1, 1) + build(j, 2), w + 1); } } } else if (!x && y) { if (g[i][j + 1]) insert(cur, state, w + 1); if (g[i + 1][j]) insert(cur, state - build(j, y) + build(j - 1, y), w + 1); } } else if (x && !y) { if (g[i + 1][j]) insert(cur, state, w + 1); if (g[i][j + 1]) insert(cur, state - build(j - 1, x) + build(j, x), w + 1); } } else if (x == 1 && y == 1) { for (int u = j + 1, s = 1;; u++) { int z = get(state, u); if (z == 1) s++;3 行未改动 break; } } } } } else if (x == 2 && y == 2) { for (int u = j - 2, s = 1;; u--) { int z = get(state, u); if (z == 2) s++;3 行未改动 break; } } } } } else if (x == 2 && y == 1) { insert(cur, state - build(j - 1, x) - build(j, y), w + 1); } } else if (i == n && j == n) { res = max(res, w); } }21 行未改动}int main() { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cout.tie(NULL); cin >> n >> m; n += 2; for (int i = 1; i <= n; i++) { for (int j = 1; j <= n; j++) {28 行未改动