1 2 3 4 5 6 7 8 9 10 11 12 13 14
| class Solution { public: vector<int> countPoints(vector<vector<int>>& points, vector<vector<int>>& queries) { int n = queries.size(); vector<int> ans(n); for (int i = 0; i < n; ++i) { int x = queries[i][0], y = queries[i][1], r = queries[i][2]; for (auto& point : points) if (pow(point[0] - x, 2) + pow(point[1] - y, 2) <= r * r) ++ans[i]; } return ans; } };
|