Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- double INF = 1e15;
- double eps = 1e-12;
- struct Point
- {
- double x, y;
- Point () {}
- Point (double a, double b) : x(a), y(b) {}
- void Print()
- {
- printf("%.3lf %.3lf\n", x, y);
- }
- double operator % (Point a)
- {
- return x * a.x + y * a.y;
- }
- double operator * (Point a)
- {
- return x * a.y - y * a.x;
- }
- Point operator - (Point a)
- {
- return Point(x - a.x, y - a.y);
- }
- };
- double a[110][3];
- double b[110][3];
- int n, m, k;
- Point p[11000];
- int main()
- {
- // freopen("input.txt", "r", stdin);
- // freopen("output.txt", "w", stdout);
- scanf("%d", &n);
- for (int i = 0; i < n; i++)
- {
- scanf("%lf%lf%lf", &a[i][0], &a[i][1], &a[i][2]);
- for (int j = 0; j < 3; j++)
- a[i][j] = (double)10000000 / a[i][j];
- }
- for (int h = 0; h < n; h++)
- {
- /* bool f = true;
- for (int i = 0; i < n; i++)
- {
- if (i == h)
- continue;
- if (a[i][0] + a[i][1] + a[i][2] <= a[h][0] + a[h][1] + a[h][2])
- f = false;
- }
- if (f)
- {
- printf("Yes\n");
- continue;
- }*/
- f = false;
- k = 0;
- for (int i = 0; i < n; i++)
- {
- if (i == h)
- continue;
- if (a[i][0] <= a[h][0] && a[i][1] <= a[h][1] && a[i][2] <= a[h][2])
- {
- f = true;
- break;
- }
- if (a[i][0] >= a[h][0] && a[i][1] >= a[h][1] && a[i][2] >= a[h][2])
- continue;
- for (int j = 0; j < 3; j++)
- b[k][j] = a[i][j] - a[h][j];
- k++;
- }
- if (f)
- {
- printf("No\n");
- continue;
- }
- //printf("%d %d\n", h, k);
- b[k][0] = 1;
- b[k][1] = 0;
- b[k][2] = 0;
- k++;
- b[k][0] = 0;
- b[k][1] = 1;
- b[k][2] = 0;
- k++;
- b[k][0] = -1;
- b[k][1] = 0;
- b[k][2] = INF;
- k++;
- b[k][0] = 0;
- b[k][1] = -1;
- b[k][2] = INF;
- k++;
- m = 0;
- for (int i = 0; i < k; i++)
- {
- for (int j = i + 1; j < k; j++)
- {
- double tmp = b[i][0] * b[j][1] - b[i][1] * b[j][0];
- if (fabs(tmp) < eps)
- continue;
- Point S = Point( -(b[i][2] * b[j][1] - b[j][2] * b[i][1]) / tmp, (b[i][2] * b[j][0] - b[j][2] * b[i][0]) / tmp );
- //S.Print();
- bool g = false;
- for (int l = 0; l < k; l++)
- {
- if (b[l][0] * S.x + b[l][1] * S.y + b[l][2] < 0)
- g = true;
- }
- if (g)
- continue;
- p[m] = S;
- m++;
- }
- }
- //printf("%d %d\n", h, m);
- //for (int i = 0; i < m; i++)
- //p[i].Print();
- //printf("******\n");
- for (int i = 2; i < m; i++)
- {
- if (fabs((p[1] - p[0]) * (p[i] - p[0])) > eps)
- f = true;
- }
- if (f)
- printf("Yes\n");
- else
- printf("No\n");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement