Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Solution {
- public:
- double calDist(vector<int> s, vector<int> t)
- {
- return abs(s[0] - t[0]) + abs(s[1] - t[1]);
- }
- bool escapeGhosts(vector<vector<int>>& ghosts, vector<int>& target) {
- double mine = calDist({0,0}, target);
- for(auto ghost : ghosts)
- {
- if(mine > calDist(ghost, target)) return false;
- }
- return true;
- }
- };
Add Comment
Please, Sign In to add comment