You are viewing a single comment's thread. Return to all comments →
#include <stdio.h> int main () { int i, q; scanf("%d", &q); for (i = 1; i <= q; i++) { int j, n, minx, maxx, miny, maxy, count = 0; scanf("%d", &n); int x[n], y[n]; for (j = 0; j < n; j++) { scanf("%d %d", &x[j], &y[j]); } minx = x[0], maxx = x[0], miny = y[0], maxy = y[0]; for (j = 1; j < n; j++) { if (x[j] < minx) { minx = x[j]; } if (x[j] > maxx) { maxx = x[j]; } if (y[j] < miny) { miny = y[j]; } if (y[j] > maxy) { maxy = y[j]; } } for (j = 0; j < n; j++) { if (x[j] > minx && x[j] < maxx && y[j] > miny && y[j] < maxy) { count++; } } if (count > 0) { printf("NO\n"); } else { printf("YES\n"); } } }
Seems like cookies are disabled on this browser, please enable them to open this website
Points on a Rectangle
You are viewing a single comment's thread. Return to all comments →