Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct Point {
- double x, y;
- };
- int T, n, width, height;
- ordered_set<int> st; // Policy-based DS https://codeforces.com/blog/entry/11080
- double dist(Point& point, Point& checker) {
- return sqrt((point.x - checker.x) * (point.x - checker.x) + (point.y - checker.y) * (point.y - checker.y));
- }
- int main() {
- cin >> width >> height >> n;
- vector<Point> points(n);
- for (int i = 0; i < n; ++i) {
- cin >> points[i].x >> points[i].y;
- }
- Point checker{3.28, 2.35};
- Point expected{4.0, 2.0};
- double min_dist = INT_MAX / 10;
- for (auto& point: points)
- min_dist = min(min_dist, dist(point, checker));
- cout << "Obtained: " << min_dist << '\n';
- double min_exp_dist = INT_MAX / 10;
- for (auto& point: points)
- min_exp_dist = min(min_exp_dist, dist(point, expected));
- cout << "But expected: " << min_exp_dist << '\n';
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement