BEAT 100% || C++
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nint mp[2652], *zp[2652], zc[2652], step, mk;\n\nint dfs(int *p) {\n    *p = 2;\n    int res = 0;\n    for (int *nb : {p-step, p-1, p+1, p+step}) {\n        int v = *nb;\n        if (v == mk || v > 1) continue;\n        if (v <= 0) *nb = mk, ++res; else res += dfs(nb);\n    }\n    return res;\n}\nint dfs2(int *p) {\n    *p = 1000;\n    int res = 0;\n    for (int *nb : {p-step, p-1, p+1, p+step}) {\n        int v = *nb;\n        if (v == 2) res += dfs2(nb); else if (v <= 0) ++res, *nb = 0;\n    }\n    return res;\n}\nvoid dfs3(int *p) {\n    *p = 1;\n    for (int *nb : {p-step, p-1, p+1, p+step}) {\n        int v = *nb;\n        if (v == 2) dfs3(nb); else if (v <= 0) *nb = 1;\n    }\n}\nclass Solution {\npublic:\n    int containVirus(vector<vector<int>>& isInfected) {\n        step = isInfected[0].size() + 1; mk = 0;\n        {\n            int *p = mp+step;\n            fill(mp, p, 1000);\n            for (const auto &r : isInfected) {\n                for (int x : r) *p++ = x;\n                *p++ = 1000;\n            }\n            fill(p, p+step, 1000);\n        }\n        int *lo = mp+step, *hi = lo + step*isInfected.size(), res = 0;\n        while(1) {\n            int nb = 0;\n            for (int *p = lo; p != hi; ++p) if (*p == 1) zp[nb] = p, --mk, zc[nb++] = dfs(p);\n            if (nb == 0) break;\n\n            int best = 0;\n            for (int i = 1; i < nb; ++i) if (zc[i] > zc[best]) best = i;\n            if (!zc[best]) break;\n            res += dfs2(zp[best]);\n\n            for (int *p = lo; p != hi; ++p) if (*p == 2) dfs3(p);\n        }\n        return res;\n    }\n};\n```
['C++']