ABC010C 浮気調査

C: 浮気調査 - AtCoder Beginner Contest 010 | AtCoder

(null)

一人ひとり,その場所に行って電話に出た場所まで 以内にいけるを試す.移動した距離が より小さければ可能である.

Code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>
#include <sstream>
#include <map>
#include <set>
#include <cmath>

#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1<<30
#define pb push_back
#define mp make_pair
#define EPS 1e-8
#define equals(a,b) fabs((a) - (b)) < EPS

using namespace std;
typedef long long ll;
typedef pair<int,int> P;

struct Point {
  double x, y;

  Point(double x=0, double y=0) : x(x), y(y) {}

  Point operator+(const Point &o) const { return Point(x+o.x, y+o.y); }

  Point operator-(const Point &o) const { return Point(x-o.x, y-o.y); }

  Point operator*(const double m) const { return Point(x*m, y*m); }

  Point operator/(const double d) const { return Point(x/d, y/d); }

  bool operator<(const Point &o) const { return x != o.x ? x < o.x : y < o.y; }

  bool operator==(const Point &o) const { return fabs(x-o.x) < EPS && fabs(y-o.y) < EPS; }
};

ostream& operator << (ostream& os, const Point& p) {
  os << "(" << p.x << ", " << p.y << ")";
  return os;
}

double dot(Point a, Point b) { return a.x * b.x + a.y * b.y; }
double cross(Point a, Point b) { return a.x * b.y - a.y * b.x; }
double atan(Point p) { return atan2(p.y, p.x); }
double norm(Point p) { return p.x * p.x + p.y * p.y; }
double abs(Point p) { return sqrt(norm(p)); }
double distancePP(Point p, Point o) { return sqrt(norm(o - p)); }

int main() {
  Point s, t;
  int T, V;
  cin >> s.x >> s.y >> t.x >> t.y >> T >> V;

  bool flag = false;

  int n;
  cin >> n;

  rep(i, n) {
      Point p;
      cin >> p.x >> p.y;

      if(distancePP(s, p) + distancePP(p, t)  <= T * V) {
          flag = true;
      }
  }

  if(flag) {
      cout << "YES" << endl;
  } else {
      cout << "NO" << endl;
  }

  return 0;
}
Apr 3rd, 2016