Guest User

Untitled

a guest
Mar 19th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. class Solution {
  2. public:
  3. double calDist(vector<int> s, vector<int> t)
  4. {
  5. return abs(s[0] - t[0]) + abs(s[1] - t[1]);
  6. }
  7.  
  8. bool escapeGhosts(vector<vector<int>>& ghosts, vector<int>& target) {
  9. double mine = calDist({0,0}, target);
  10.  
  11. for(auto ghost : ghosts)
  12. {
  13. if(mine > calDist(ghost, target)) return false;
  14. }
  15.  
  16. return true;
  17. }
  18. };
Add Comment
Please, Sign In to add comment