fork(1) download
  1. #include <cstdio>
  2. #include <iostream>
  3. #include <algorithm>
  4. #include <string>
  5. #include <vector>
  6. #include <cmath>
  7.  
  8. using namespace std;
  9.  
  10. typedef vector<int> VI;
  11. typedef vector <double> VD;
  12. typedef long long LL;
  13.  
  14. #define FOR(x, b, e) for(int x=b; x<=(e); ++x)
  15. #define FORD(x, b, e) for(int x=b; x>=(e); ––x)
  16. #define REP(x, n) for(int x=0; x<(n); ++x)
  17. #define VAR(v,n) typeof(n) v=(n)
  18. #define ALL(c) c.begin(),c.end()
  19. #define SIZE(x) (int)x.size()
  20. #define FOREACH(i,c) for(VAR(i,(c).begin());i!=(c).end();++i)
  21. #define PB push_back
  22. #define ST first
  23. #define ND second
  24.  
  25. double d(double x1, double y1, double x2, double y2)
  26. {
  27. return sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
  28. }
  29.  
  30. int main()
  31. {
  32. ios_base::sync_with_stdio(0);
  33.  
  34. double gopherX, gopherY, dogX, dogY, x, y;
  35. int n;
  36. bool check;
  37.  
  38. while(cin>>n>>gopherX>>gopherY>>dogX>>dogY)
  39. {
  40. check = true;
  41. REP(i, n)
  42. {
  43. cin>>x>>y;
  44.  
  45. if(2*d(gopherX, gopherY, x, y) < d(dogX, dogY, x, y))
  46. {
  47. printf("The gopher can escape through the hole at (%.3lf,%.3lf).\n", x, y);
  48. check = false;
  49. break;
  50. }
  51. }
  52. if(check)cout<<"The gopher cannot escape.\n";
  53. }
  54.  
  55. return 0;
  56. }
  57.  
  58.  
Success #stdin #stdout 0s 3480KB
stdin
10 2 4 4 6
5
3
5
9
9
7
1
7
4
5
6
3
0
0
7
2
1
1
7
4
10 4 6 5 6
1
6
5
6
5
3
3
1
7
0
4
9
3
9
0
7
4
4
7
2
10 9 1 5 0
9
6
5
2
4
8
9
6
6
9
2
6
7
9
9
8
6
6
9
7
10 1 6 7 9
3
9
0
0
0
3
1
7
0
1
2
2
9
9
2
9
4
0
0
8
10 6 8 4 9
2
7
2
3
1
1
7
4
1
7
4
5
6
3
6
4
1
8
5
1
10 5 0 7 4
0
6
0
6
3
8
2
5
3
5
4
1
0
3
3
6
2
0
3
5
10 6 0 9 3
0
6
3
4
4
0
8
3
4
2
9
9
1
8
3
9
3
2
3
0
10 2 4 8 7
2
9
3
7
9
4
2
0
3
6
9
0
7
7
4
0
8
8
8
1
10 6 3 4 2
2
9
5
3
4
4
3
2
7
9
5
4
2
8
5
6
2
8
0
6
10 7 5 0 5
4
1
3
9
8
3
3
9
6
1
4
9
6
4
7
5
7
0
6
1
stdout
The gopher cannot escape.
The gopher cannot escape.
The gopher cannot escape.
The gopher cannot escape.
The gopher cannot escape.
The gopher cannot escape.
The gopher cannot escape.
The gopher cannot escape.
The gopher cannot escape.
The gopher cannot escape.
The gopher cannot escape.
The gopher can escape through the hole at (0.000,3.000).
The gopher can escape through the hole at (0.000,8.000).
The gopher can escape through the hole at (4.000,1.000).
The gopher can escape through the hole at (3.000,4.000).
The gopher can escape through the hole at (2.000,9.000).
The gopher can escape through the hole at (6.000,9.000).
The gopher can escape through the hole at (7.000,9.000).
The gopher can escape through the hole at (3.000,3.000).
The gopher can escape through the hole at (7.000,0.000).