[ C++ ] [ DFS ]
Code\n\nstruct Solution {\n    int maximumDetonation(vector<vector<int>>& a) {\n        int n = (int) a.size();\n        vector<vector<int>> g(n);\n        for 
# Code\n```\nstruct Solution {\n    int maximumDetonation(vector<vector<int>>& a) {\n        int n = (int) a.size();\n        vector<vector<int>> g(n);\n        for (int i = 0; i < n; i++) {\n            for (int j = 0; j < n; j++) {\n                if (i == j) {\n                    continue;\n                }\n                long long dx = a[j][0] - a[i][0];\n                long long dy = a[j][1] - a[i][1];\n                long long dd = dx * dx + dy * dy;\n                if (dd <= 1LL * a[i][2] * a[i][2]) {\n                    g[i].emplace_back(j);\n                }\n            }\n        }\n        int ans = 0;\n        for (int r = 0; r < n; r++) {\n            vector<int> b(n);\n            auto dfs = [&](auto&& self, int v, int p) -> void {\n                b[v] = 1;\n                for (int to : g[v]) {\n                    if (to == p || b[to]) {\n                        continue;\n                    }\n                    self(self, to, v);\n                }\n            };\n            dfs(dfs, r, -1);\n            ans = max(ans, accumulate(b.begin(), b.end(), 0));\n        }\n        return ans;\n    }\n};\n```
['Depth-First Search', 'C++']