Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdlib>
- #include <cstring>
- #include <cmath>
- #include <algorithm>
- #include <vector>
- #include <string>
- using namespace std;
- struct router
- {
- public:
- int rx, ry, r;
- //double r1 = (double)r;
- int distance_from_center(int a, int b)
- {
- int dis = ((rx - a)*(rx - a) + (ry - b)*(ry - b));
- if (dis <= (r*r))
- {
- /*cout << "dis = " << dis<< " "<<"r^2 = "<<r * r<< endl;
- cout << 1 << endl;*/
- return 1;
- }
- /*cout << "dis = " << dis << " " << "r^2 = " << r * r << endl;
- cout << -1 << endl;*/
- return-1;
- }
- };
- int main()
- {
- int t;
- cin >> t;
- int z = 1;
- while (z <= t)
- {
- int n, y;
- cin >> n >> y;
- vector<router>v;
- for (int i = 0; i < n; i++)
- {
- int a, b, c;
- cin >> a >> b >> c;
- router k;
- k.rx = a;
- k.ry = b;
- k.r = c;
- v.push_back(k);
- }
- int d = 0;
- cout << "Case " << z << ": " << endl;
- for (int i = 0; i < y; i++)
- {
- d = 0;
- int a, b;
- cin >> a >> b;
- for (int j = 0; j < v.size(); j++)
- {
- if (v[j].distance_from_center(a, b) == 1)
- {
- d = 1;
- break;
- }
- }
- if (d == 1)cout << "Yes" << endl;
- else cout << "No" << endl;
- }
- z++;
- v.clear();
- }
- return 0;
- }
- /*
- 3 5 L D L D W 6 L D W L L L 3 D D W
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement