You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

50 lines
1.3 KiB
C++

#define _CRT_SECURE_NO_WARNINGS
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-3;
inline int sgn(double x)
{
fprintf(stderr, "Det %lf\n", x);
if (x > eps) return 1;
if (x < -eps) return -1;
return 0;
}
struct Point
{
double x, y;
Point operator-(const Point &rhs) { return {x - rhs.x, y - rhs.y}; }
double len() { return hypot(x, y); }
};
double area(Point A, Point B, Point C)
{
double a = (B - C).len();
double b = (A - C).len();
double c = (A - B).len();
double p = (a + b + c) / 2;
return sqrt(p * (p - a) * (p - b) * (p - c));
}
Point ps[2050];
int main()
{
ios::sync_with_stdio(false);
int n;
double S;
cin >> n >> S;
for (int i = 0; i < n; i++)
cin >> ps[i].x >> ps[i].y;
for (int i = 0; i < n; i++)
for (int j = i + 1; j < n; j++)
for (int k = j + 1; k < n; k++)
if (sgn(S - area(ps[i], ps[j], ps[k])) == 0)
{
printf("Yes\n%.0lf %.0lf\n%.0lf %.0lf\n%.0lf %.0lf",
ps[i].x, ps[i].y,
ps[j].x, ps[j].y,
ps[k].x, ps[k].y);
exit(0);
}
puts("No");
return 0;
}