暴力枚举:O(n * m)
代码实现:
class Solution {
public:
vector<int> countPoints(vector<vector<int>>& nums, vector<vector<int>>& arr)
{
vector<int> ans;
for(auto s: arr)
{
int X = s[0], Y = s[1], R = s[2];
int cnt = 0;
for(auto c: nums)
{
int x = c[0], y = c[1];
if((X - x) * (X - x) + (Y - y) * (Y - y) <= R * R) cnt++;
}
ans.push_back(cnt);
}
return ans;
}
};